logo       

Re: RE : File Location Substitution.: msg#00009

Subject: Re: RE : File Location Substitution.
Problem is that it's a single-threaded process, for every user connecting to the system a new process is spawned.
This means I have multiple instances of the same process running simultaneously.
And I would like to have a log file per process.

I could send my loggings to Syslog but strangely enough the SysLogAppender seems to be a lot slower than the FileAppender
and besides I wouldn't have a log file per process.

Note that I'm still using 0.9.7, but if the features I was asking for are available in CVS HEAD I would consider upgrading.

Maarten

Alexandre Gacon wrote:
Instead of calling the file with the pid in the name, couldn't you use a
unique rolling file and output the thread id in the result, using a pattern
appender for example ?

Alexandre

-----Message d'origine-----
De : maarten [mailto:maartenb@xxxxxx] 
Envoyé : vendredi 5 août 2005 09:17
À : Log4CXX User
Objet : Re: File Location Substitution.


Are there any other properties that I can use as placeholders in my 
log4cxx.properties file.
Can I use environment variables, that will be expanded at runtime ? What
about the process id ?

What I do now is define a RollingFile appender in my properties file and 
do my own hard-coded initialization :

  Appender* appender = Logger::getRootLogger()->getAppender ("RollingFile");
  FileAppender* fa = dynamic_cast<FileAppender*>(appender);
  if (fa != 0) {
     string fullpath = "/var/log/example_" + getEnvVar("REMOTE_IP") + 
"_" + getDatetime() + "_" + getPID() + ".log";
     fa->setFile ( fullpath );
     fa->activateOptions();
  }

Thanks,
Maarten

Curt Arnold wrote:

  
On Aug 4, 2005, at 10:55 PM, macdev wrote:

    
I know I can set the location of the logfile used by Log4CXX using
the config files. I do this in the snippet I have included below.  
But how do I tailor the location at runtime? For example on a unix  
system how can make sure the logs go to a specific folder beneath  
the users home folder.

logdir=/Users/devguy/library/Application Support/logs

log4j.appender.PriParser=org.apache.log4j.FileAppender
log4j.appender.PriParser.File=${logdir}/parser_internal.log

Thanks.
p.s. I bought the manual hoping it would help me, but what I am
looking for eludes me.
      
log4cxx mimics the user.home, user.name, user.dir, java.io.tmpdir  
properties that work with log4j.  So you could do:

    
log4j.appender.PriParser.File=${user.home}/parser_internal.log
      



    



  

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe