'log4j: Why isn't log file created?

I'm using the following log4j.properties file:

# Define the root logger with appender file
log4j.rootLogger = DEBUG, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.RollingFileAppender

# Set the name of the file
log4j.appender.file.File=/log.out

# Set the immediate flush to true (default)
log4j.appender.FILE.ImmediateFlush=true

# Set the threshold to debug mode
log4j.appender.FILE.Threshold=debug

# Set the append to false, overwrite
log4j.appender.FILE.Append=true

# Define the layout for file appender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%m%n

I'm using the following imports:

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

I see that log messages are printed to the console. However, I don't find the file /out.log (it's not created). Do you know what I can do about it?

Edit: I also seems that log4j.properties file is ignored.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source