This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j not logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j not logging" Watch "log4j not logging" New topic
Author

log4j not logging

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
I have just successfully gotten a log4j XML configuration to load.

Here is the configuration:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="c:\log\A3.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="500KB"/>
<param name="MaxBackupIndex" value="1"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} - [%C.%M] - %p - %m%n"/>
</layout>
</appender>

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="DEBUG"/>

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>

<category name="com.enetrix.sis">
<priority value="INFO"/>
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</category>


<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>

</log4j:configuration>


where com.enetrix.sis is a parent package to several other packages. Notice that I'm logging to both a category and the root logger.

I get no output neither console or file. It isn't my Java, I've used log4j for years. Any suggestions?


Eric
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It looks like you've taken care of everything servlet specific in your last post
http://www.coderanch.com/t/365514/Servlets/java/initializing-log

So..
I'm going to move this to our Other Open Source Projects forum where Log4j is usually covered.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9924
    
158

Can you post the code where you initialize the logger and also the piece of code where you are logging the messages?


[My Blog] [JavaRanch Journal]
John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Solved my problem. My log4j.xml wasn't named log4j.xml!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: log4j not logging
 
Similar Threads
Jboss final start up message not comes up in console
log4j - creating my own file
How to monitor log file in jboss for sending mails,when error or excetion found in log
RollingFileAppender not happening
Multiple File Appenders in log4j