hi! simon,
   u have used commons logging factory.. but my requirement is to use log4j
with support of MDC/NDC logging the feature which is required in my app. so
if anyone has implemented log4j(MDC/NDC) with struts,  code snippets would
be a gr8 resource for me..

any other sugesstion are also welcome..

anyway thanks for the code ...simon

rgds,
dinesh

----- Original Message -----
From: "Simon Kelly" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 3:47 PM
Subject: Re: struts & log4j


> Here is a copy of the mail that was sent to me for logging in struts from
> Nicolas Robert.
>
> I followed the top class section, and let struts handle every thing else.
>
> Cheers
>
> Simon
>
> [snip]
> ------------------ Here's a sample of logging :
> ...
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> ...
> /**
>  * This class is used to control the add search form.
>  * @author nr gf
>  */
> public class AddSearch2 extends PpwAction {
>
> /**
> * Used for logging
> */
> private transient static final Log log =
> LogFactory.getLog(AddSearch2.class);
> ...
> if (log.isDebugEnabled()) {
> log.debug("blablabla");
> }
> ...
> try {
> ...
> } catch (Exception e) {
> log.debug("an exception occurs... : ",e);
> }
>
> ---------------------- Here's a sample of log4j.properties config file
> # CONFIGURATION FOR AN Log4J Logger
> # ---------------------------------
> log4j.debug=false
> log4j.rootLogger=ERROR, ConsoleLogger
>
> # Console Logger Definition
> # -------------------------
> log4j.appender.ConsoleLogger=org.apache.log4j.ConsoleAppender
> log4j.appender.ConsoleLogger.ImmediateFlush=true
> log4j.appender.ConsoleLogger.layout=org.apache.log4j.PatternLayout
>
log4j.appender.ConsoleLogger.layout.ConversionPattern=[%-5p-%d{HH:mm:ss,SSS}
> -%c{1}-%M-%-L] %m%n
>
> # Commons Validator
> # -----------------
> log4j.logger.org.apache.commons.validator.ValidatorResources=ERROR
> log4j.logger.org.apache.struts.validator.ValidatorPlugIn=ERROR
>
> # Commons Resource
> # ----------------
> log4j.logger.org.apache.struts.util.PropertyMessageResources=ERROR
>
> --> Please note that every classes must begin with log4j.logger
>
> [snip]
> ----- Original Message -----
> From: "Dinesh Sampangi" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, February 13, 2003 10:44 AM
> Subject: Re: struts & log4j
>
>
> > hi!
> >  it doesn't to have any effect.. still the same..
> >
> > rgds,
> > dinesh
> >
> > ----- Original Message -----
> > From: "Simon Kelly" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, February 13, 2003 2:14 PM
> > Subject: Re: struts & log4j
> >
> >
> > > should be written as
> > >
> > > private transient static final Log log =
> > > LogFactory.getLog(xxx.yyy.zzz.class);
> > >
> > > Where xxx.yyy.zzz is the full class path with in the package.
> > >
> > > Simon
> > >
> > > ----- Original Message -----
> > > From: "Dinesh Sampangi" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Thursday, February 13, 2003 9:05 AM
> > > Subject: struts & log4j
> > >
> > >
> > > Hi! All,
> > >           i'm trying to use log4j in struta application.. but when i
> > create
> > > a log4j instance inside(
> > > private final static Logger log = Logger.getLogger(PAF3Entity.class)
> > > ) strut action class..the action path is not forwarded..instead it
> throws
> > > the following at the console.
> > >
> > > 2003-02-13 01:28:22 - Ctx( /medicare ): 500 R( /medicare +
> > > /Authorisationone.do
> > > + null) No action instance for path /Authorisationone could be created
> > >
> > > but the action tag class & its paths is well defined in the struts
> config
> > > file.. everything runs fine if the logger instance is not created.
> > >
> > > has anyone exp.. this sort . pls help
> > >
> > > TIA
> > > Dinesh
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to