logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject Re: forced log
Date Wed, 02 Sep 2009 17:54:52 GMT
You could define a separate logger for your the ones you always want log...

logger = log4net.LogManager.GetLogger("AlwaysLog")
logger.info("hello world")

<logger name="AlwaysLog">
    <level value="ALL" />
    <appender-ref ref="..." />

Depending on how you usually get a logger...


This has the downside of not knowing which class you are logging from...

Might work for your circumstance...


On Wed, Sep 2, 2009 at 10:36 AM, scamper_22<scamper_22@hotmail.com> wrote:
> Hi all,
> I'm looking for a way to force a log without using Fatal.
> For example, let us say I want to print a log with the application name and
> version.  I want this printed regardless of what the log level is.
> Right now, I am just using the fatal log level.  The problem with this is it
> ruins some of the data collection we have where we have a count of the
> number of errors/fatal logs.
> Is there some way to do a logger.ForcedLog( INFO, "my string") ?  Which
> basically ignores the priority of the message, but still logs it?
> I have see this ForcedLog API in log4j
> (http://logging.apache.org/log4j/1.2/apidocs/index.html)
> but it does not seem to in log4net (
> Thanks,
> --
> View this message in context: http://www.nabble.com/forced-log-tp25259981p25259981.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.

View raw message