I guess I didn't look hard enough.  I found out how to do it:

<file type="log4net.Util.PatternString"
value="logs/RecBuilder.%property{log4net:HostName}.log" /> 

-----Original Message-----
From: Pelton, Brian [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 27, 2006 12:51 PM
To: log4net-user@logging.apache.org
Subject: Use properties in log file name

I would like to use the host name in the log file's name:
 
  <appender name="LogAppender" type="log4net.Appender.FileAppender,
log4net">
    <file value="logs/RecBuilder.[%p{log4net:HostName}].log" />

But this doesn't work.
When I look at log4net's internal log, it says it cannot create the
appender because:
"System.NotSupportedException: The given path's format is not
supported."


Is there anyway to have a dynamic log file name based on the machine
name or other environment variables?

--Brian

Reply via email to