Curt Arnold wrote: 
On Apr 11, 2008, at 1:28 PM, Patrick Lannigan wrote:
> In a project that uses log4net, I have successfully added the  
> pattern demonstrated to access Windows Special folders
> http://mail-archives.apache.org/mod_mbox/logging-log4net-user/200506.mbox/[EMAIL
>  PROTECTED]
>
> I am now trying to do the same with log4cxx, but seem to be running  
> into some roadblocks. Is it possible to produce this same result in  
> log4cxx? If so, can an example be given to show how the log4cxx  
> version would differ from log4net?

Could you explain your use case?  The most obvious one to me is to be  
able to use a folder path in a configuration file to specify the  
location of a log file, but that isn't consistent with the log4net  
example.  The location of special folders should not change during a  
run, so I don't see the value in adding it as a converter for the  
pattern layout.  It would just be simpler to output the value of the  
special folders as INFO logging requests at the start of the run  
instead of evaluating them over and over during the layout of messages.
I am using it to set the path to a log file. I need to place the log file in 
the common app data folder, which can be different for each machine and is only 
known at runtime. So I used the following in my log4net config file.

      <file type="log4net.Util.PatternString">
        <converter>
          <name value="folder" />
          <type value="log4net.SpecialFolderPatternConverter,MCLI" />
        </converter>
        <converter>
          <name value="subdir" />
          <type value="log4net.ProductSubDirectoryPatternConverter,MCLI" />
        </converter>
        <conversionPattern 
value="%folder{CommonApplicationData}\%subdir\mcli.log" />
      </file>

I am trying to achieve this same functionality with the log4cxx config file. I 
have also found that specifying a file name without a path creates a file in 
the base directory. This means in order to write to the correct folder I would 
have to write my own functions to create the appender and build a file name 
based on what the calling process is. This limits the runtime configurability 
to just log levels and we would need a new binary in order to change what 
information is printed for each log message.

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to