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="..." />
</logger>

Depending on how you usually get a logger...

    .GetLogger(GetType(Foo))

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

Might work for your circumstance...

Mike

On Wed, Sep 2, 2009 at 10:36 AM, scamper_22<scamper...@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 (1.2.10.0).
>
> 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.
>
>
  • forced log scamper_22
    • Re: forced log Michael Schall

Reply via email to