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
java linux logging log4j fileappender


source to share


No one has answered this question yet

Check out similar questions:

4800
How to find all files containing specific text in Linux?
1773
How to symbolize a file in Linux?
59
Disabling Hibernation Management Console Output
3
Log4j.properties file not found on classpath or is being ignored
2
Problem with log4j log not writing to file
1
log4j: WARN No such property [append] in org.apache.log4j.ConsoleAppender
0
Is there a way to define the default layout?
0
Why is log4j logging in two separate files?
0
How to add and fix print stream in log file using log4j via properties file
0
Log4j does not print to console



All Articles
Loading...
X
Show
Funny
Dev
Pics