You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Billy W. Talton" <Bi...@supervalu.com> on 2006/03/02 23:18:54 UTC
log4j...help.
All,
I haven't used log4j a whole lot. Having noticed that logging in not
particularly a strongsuit in the applications at my job, I decided that I
would implement this industry-standard in my next project. I downloaded
the latest version, installed and configured it rather easily and I was
off and running.. i thought. I've been stumped by this one problem...
I've been going nuts trying to figure out how to output to a
file/directory in my web application. I'm able to go to database and
console just fine. A few other Appenders worked as well. As I've found,
log4j prints directly to my WSAD root install directory. This is a
problem for me since I share a server with other teams and applications. I
could create a NAS share but that creates portability issues. This has to
be simple but I'm Googlestumped. Here's my log file. Any ideas?
___
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="USER_LOG" class="org.apache.log4j.ConsoleAppender"
>
<param name="Threshold" value="debug" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{2}
- %m\n" />
</layout>
</appender>
<appender name="PERF_LOG" class="org.apache.log4j.FileAppender">
<param name="File" value="perf.log" />
<param name="Threshold" value="info" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{2}
- %m\n" />
</layout>
</appender>
<appender name="ROLE_LOG" class=
"org.apache.log4j.RollingFileAppender">
<param name="File" value="es_edi.log" />
<param name="MaxBackupIndex" value="10" />
<param name="MaxFileSize" value="1000KB" />
<param name="Threshold" value="debug" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d] %t %c
%-5p - %m%n" />
</layout>
</appender>
<logger name="com.xxx.xxx">
<level value="DEBUG" />
<appender-ref ref="PERF_LOG" />
<appender-ref ref="USER_LOG" />
<appender-ref ref="ROLE_LOG" />
</logger>
<root>
<priority value="debug" />
<appender-ref ref="USER_LOG" />
</root>
</log4j:configuration>