logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Emory <repairman2...@gmail.com>
Subject Re: configuration with dynamic settings
Date Tue, 31 Aug 2010 14:52:25 GMT
In your config file you can set your appender to be like:

<appender name="something" type="log4net.Appender.RollingFileAppender">
   <file type="log4net.Util.PatternString" value="%property{LogName}" />
    ...
</appender>

Then you just need to set the value of the property "LogName" somewhere,
which you can easily set it through command line arguments if you choose:
log4net.GlobalContext.Properties["LogName"] = @"c:\somewhere\file.log";

On Tue, Aug 31, 2010 at 6:01 AM, Andreas Mucha <singtur@gmx.net> wrote:

> i forgot to say that in my little log4j example
>
> "log4j.appender.fileout.File=../some/path/${applicationname}_${somepropvalue}.log"
> the applicationname and somepropvalue was defined as
> vm prop (java -Dsomepropvalue=...)
>
> i would like to set up the same for log4net .
>
> -------- Original-Nachricht --------
> > Datum: Tue, 31 Aug 2010 11:56:59 +0200
> > Von: "Andreas Mucha" <singtur@gmx.net>
> > An: log4net-user@logging.apache.org
> > Betreff: configuration with dynamic settings
>
> > hello all
> >
> > i try to configure log4net like log4j with some dynamic settings.
> > e.g. in log4j i can configure a dynamic file name like
> >
> log4j.appender.fileout.File=../some/path/${applicationname}_${somepropvalue}.log
> >
> > for application name 'a' and somepropvalue 'p' this would result
> > in a file named a_p.log.
> > (this works also for rolling file appenders)
> >
> > the only way i found until now is todo it in the application code.
> >
> > big question is how to configure this behaviour in config file ??
> >
> > many thanks in advance.
> > --
> > Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> > Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
>
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>

Mime
View raw message