Create a logger named "status" and send it to the appropriate appenders.

On 12/23/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm evidently missing a lot.
>
> I don't know how MDC or NDC can ensure that particular messages are
> ALWAYS logged yet not identified as some sort of Error (ERROR or
> FATAL level).  I thought the Level always determines whether or not a
> particular message is logged and the MDC/NDC provided extra context
> information.
>
> I cannot find any information on a "STATUS logger".  Do you have a
> URL that explains this concept and how to set one up in a
> log4j.properties/log4j.xml configuration file?
>
> Mike
>
>
> On Dec 23, 2005, at 10:51 AM, Scott Deboy wrote:
>
> >
> > You could use NDC,MDC or a STATUS logger for this.
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Fri 12/23/2005 4:10 AM
> > To: [email protected]
> > Subject: Re: How to add a new  logging level that is  independent
> > of the defualt ones.
> >
> > Perhaps this is a situation that would warrant creating a new logging
> > level:
> >
> > There are some messages that we want to always appear in our logs,
> > but we don't want to identify them as FATAL errors.
> > These messages indicate the beginning and ending of certain important
> > processes.
> >
> > To facilitate this requirement, we:
> > 1.  Created a Log4JHelper Class that does things like setting up our
> > ConfigureAndWatch
> >
> > 2.  Created a MyLevel class in the Helper class as:
> >
> >      private static class MyLevel extends Level {
> >          private MyLevel(int level, String name, int sysLogLevel) {
> >              super(level, name, sysLogLevel);
> >          }
> >      }
> >
> > 3.  Created a STATUS Level in the Helper Class as:
> >      /**
> >       * Provides a Log4J [EMAIL PROTECTED] org.apache.log4j.Level Level} 
> > that
> > always logs unless logging is completely turned off.
> >       */
> >      public static final Level STATUS_LEVEL = new MyLevel
> > (Priority.FATAL_INT + 10, "STATUS", SyslogAppender.LOG_LOCAL0);
> >
> >
> > Now, when we want to log something at the STATUS level, we use the
> > following Logger instantiation, and log call:
> >      private static final Logger LOG = Logger.getLogger
> > (SomeClass.class);
> >          .
> >          .
> >          .
> >      LOG.log(Log4JHelper.STATUS_LEVEL,"Some Message");
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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

Reply via email to