Log4j FileAppender not writing on Linux

In a standalone application, I am using log4j for logging and configured it with the following properties file:

# Root logger option
log4j.rootLogger=WARN, file, stdout
log4j.logger.com.tr = INFO

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=log4j.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

      

On Windows, this works as expected, creating a log4j.log file in the current working directory. When I run the application on Linux, it does not report an error, but it does not generate a log file. The logger outputs to the console are just fine.

I tried to programmatically change the File property from relative path to absolute path and didn't change anything.

I have also confirmed that if I supply an invalid file name, the tool reports an error indicating that the file could not be generated. So I don't understand why no error message is reported and no file is generated.

I have searched my hard drive for the file to make sure it is not being created elsewhere and it is not.

Any help here would be much appreciated.

+3


source to share





All Articles