wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes Using FileAppender - Unable to log to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Using FileAppender - Unable to log to a file" Watch "Using FileAppender - Unable to log to a file" New topic

Using FileAppender - Unable to log to a file

Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42


I am new to using log4j. I am just trying out a sample Java web application using tomcat6.0.18, log4j(log4j1.2.11.jar), Struts, and Eclipse Juno IDE on Windows

My Issue - I can see the DEBUG and INFO logs in eclipse console window but somehow they are not logged to a file. Not sure if I have missed something.
Could someone please help me?

Below is the log4j configuration in my sample application for reference:

1) log4j.properties:
I have this file under src folder in my application in eclipse IDE

log4j.rootLogger=DEBUG, myDebug, myConsole

# Configure the myConsoleappender
log4j.appender.myConsole.layout.ConversionPattern=%d{yyyy-MMM-dd HH:mm:ss,SSS} - %p %c - %m%n

# Configure the myDebug appender
log4j.appender.myDebug.layout.ConversionPattern=%d{yyyy-MMM-dd HH:mm:ss,SSS} - %p %c - %m%n

2) web.xml:


Please let me know if any other details are needed.

Thanks in advance,

-Jim Patrick
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Perhaps you are looking in the wrong place for those log files? I don't see anything wrong with what you posted, and it says to write the logs into the /logs folder. So do you have such a folder? Does your server have permission to write in it and create files in it?
Don't get me started about those stupid light bulbs.
subject: Using FileAppender - Unable to log to a file
Similar Threads
what is log4j.properties , why we need this. how to create this in java project using eclipse IDE
Log4j in Eclipse Vs Log4j Outside Eclipse
Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?
Spring JDBC Problem getting log messages