struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hall" <dh...@utrs.com>
Subject RE: log4j - urgent
Date Wed, 14 Jun 2006 13:25:47 GMT
(continued from previous msg)

HERE is the log4j.xml file I'm using (I forgot to include it in my last
message).

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

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

  <appender name="event_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="DEBUG"/>
    <param name="File" value="log/uwaf-event.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="error_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="INFO"/>
    <param name="File" value="log/uwaf-error.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="console" class="org.apache.log4j.ConsoleAppender"> 
    <param name="Target" value="System.out"/> 
    <param name="Threshold" value="INFO"/>
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
%m%n"/>
    </layout> 
  </appender> 

  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
    <appender-ref ref="event_file"/>
    <appender-ref ref="error_file"/>
  </appender>

  <!-- Setup the Root category -->
  <root>
    <appender-ref ref="ASYNC"/>
  </root>

</log4j:configuration>



-----Original Message-----
From: Li [mailto:ampyx.li@gmail.com] 
Sent: Wednesday, June 14, 2006 2:27 AM
To: Struts Users Mailing List
Subject: Re: log4j - urgent

Hi Koul,

If you wanna simply use log4j in Struts application. You can just import
log4j and create a Logger instance in your source files, something like:

import org.apache.log4j.Logger;
....

Logger logger = Logger.getLogger(YourClassName.class);

...

Then you can just use logger to log your information, something like:
...
logger.debug("debug");
logger.info("info");
...
Application servers also use log4j such as Tomcat, JBoss. You can configure
log4j for server log as well ....

Wish it helps

On 6/14/06, Abhimanyu Koul <abhimanyu_koul@fineng.com> wrote:
>
> hi all!
> i am using log4j in my application but am a bit confused about it. what r
> the steps to use log4j in my application.
> why do we need to create log4jservlet class in the application.
> is it necessary? if no, why do we create it?
> also, how does logfactory get to know that we are using log4j in the
> application
> thanks
>
> Regards,
> Abhimanyu Koul
> FinEng Solutions (P)  Ltd.
> Mobile : +91 9819510090
>
>


-- 
=====================================
The world will be ended if love is everywhere.
                                               ---- Shawzi



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message