You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Vin Karthik <vi...@yahoo.com> on 2006/04/27 15:55:19 UTC

Log statements getting mingled in one log file

Hi,
   
  I am facing a problem with log4j. I am running 2 seperate programs. Both the programs use different log files 1.txt and 2.txt respectively. When these programs(1 & 2) are run continuously, the log statements get logged in the same log file(1.txt). The logger instantiation piece of code is as follows : 
   
     public static Logger getLogInstance(String pScriptName)
   {
    if(mht.get(pScriptName) != null)
    {
     mLogger = (Logger) mht.get(pScriptName);
    }
    else
    {
     mLogger = Logger.getInstance(pScriptName);
     mht.put(pScriptName,mLogger); 
    }
  return mLogger;
   }
   
  The pScriptName variable is Unique. Not really sure why this is happening.
   
  Can someone please help me on this.
   
  Thanks
  Karthik

		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
Is that the whole config?  There are no loggers defined.

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> The config file is as follows :
>
>   ##POClose Validation Logs
>   log4j.appender.POC-VALIDATION=org.apache.log4j.FileAppender
> log4j.appender.POC-VALIDATION.File=/home/test/log/${FILENAME}
> log4j.appender.POC-VALIDATION.Append = false
> log4j.appender.POC-VALIDATION.layout=org.apache.log4j.PatternLayout
> log4j.appender.POC-VALIDATION.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %x - %m%n
>
> # SMTPPOXML is set to be a SMTPAppender.
> log4j.appender.SMTPPOC-VALIDATION= org.apache.log4j.net.SMTPAppender
> log4j.appender.SMTPPOC-VALIDATION.To = abc@xyz.com
>   log4j.appender.SMTPPOC-VALIDATION.Subject = "PO CLOSE VALIDATION"
> log4j.appender.SMTPPOC-VALIDATION.BufferSize = 1024
> log4j.appender.SMTPPOC-VALIDATION.Threshold = DEBUG
> log4j.appender.SMTPPOC-VALIDATION.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
> log4j.appender.SMTPPOC-VALIDATION.layout = com.hp.sb.interfaces.util.MailLayout
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
The value for the SBFILENAME-POC-PROCESS will be log.poc-process.<datetimestamp>. and for POC-VALIDATION, it is like 

  log4j.appender.POC-VALIDATION.File=/home/test/log/${SBFILENAME-POC-VALIDATION}, the possible value will be log.poc-validation.<datetimestamp>

  
James Stauffer <st...@gmail.com> wrote:
  What did you do for log4j.appender.POC-VALIDATION.File and what were
the values of SBFILENAME-POC-PROCESS and the other system proptery? 
What happened when you did that?

On 4/27/06, Vin Karthik wrote:
> I did it like :
>
> log4j.appender.POC-PROCESS.File=/home/test/log/${SBFILENAME-POC-PROCESS}
>
> This is not working as well.
>
> James Stauffer wrote:
> Can you explain how you did that? You could also do something like:
>
> log4j.appender.POC-VALIDATION.File=/home/test/log/VALIDATION-${SBFILENAME}
> log4j.appender.POC-PROCESS.File=/home/test/log/PROCESS-${SBFILENAME}
>
> I noticed that some of the lines in the config file start with a
> space. I would suggest removing those.
>
> On 4/27/06, Vin Karthik wrote:
> > I did try setting two separate system properties also. But that too doe snot seem to work. something unique like FILENAME_
> for each program
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
What did you do for log4j.appender.POC-VALIDATION.File and what were
the values of SBFILENAME-POC-PROCESS and the other system proptery? 
What happened when you did that?

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> I did it like :
>
>   log4j.appender.POC-PROCESS.File=/home/test/log/${SBFILENAME-POC-PROCESS}
>
>   This is not working as well.
>
> James Stauffer <st...@gmail.com> wrote:
>   Can you explain how you did that? You could also do something like:
>
> log4j.appender.POC-VALIDATION.File=/home/test/log/VALIDATION-${SBFILENAME}
> log4j.appender.POC-PROCESS.File=/home/test/log/PROCESS-${SBFILENAME}
>
> I noticed that some of the lines in the config file start with a
> space. I would suggest removing those.
>
> On 4/27/06, Vin Karthik wrote:
> > I did try setting two separate system properties also. But that too doe snot seem to work. something unique like FILENAME_
>  for each program
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
I did it like :
   
  log4j.appender.POC-PROCESS.File=/home/test/log/${SBFILENAME-POC-PROCESS}
   
  This is not working as well.

James Stauffer <st...@gmail.com> wrote:
  Can you explain how you did that? You could also do something like:

log4j.appender.POC-VALIDATION.File=/home/test/log/VALIDATION-${SBFILENAME}
log4j.appender.POC-PROCESS.File=/home/test/log/PROCESS-${SBFILENAME}

I noticed that some of the lines in the config file start with a
space. I would suggest removing those.

On 4/27/06, Vin Karthik wrote:
> I did try setting two separate system properties also. But that too doe snot seem to work. something unique like FILENAME_
 for each program

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
Can you explain how you did that?  You could also do something like:

log4j.appender.POC-VALIDATION.File=/home/test/log/VALIDATION-${SBFILENAME}
log4j.appender.POC-PROCESS.File=/home/test/log/PROCESS-${SBFILENAME}

I noticed that some of the lines in the config file start with a
space.  I would suggest removing those.

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> I did try setting two separate system properties also. But that too doe snot seem to work. something unique like FILENAME_<pScriptName> for each program

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
I did try setting two separate system properties also. But that too doe snot seem to work. something unique like FILENAME_<pScriptName> for each program

James Stauffer <st...@gmail.com> wrote:  If you run both programs in the same JVM then there can be only 1
SBFILENAME value and if both processes set it than 1 will overwrite
the value of the other. I would suggest using 2 different system
properties.

On 4/27/06, Vin Karthik wrote:
> Yes. thats correct. The log files get mixed up for POC-PROCESS and POC-VALIDATION. But i set different file names for them dynamically. For eg: In the case of POC-PROCESS, it will be like : log.poc-process.
>
> and for POC-VALIDATION, it is like : log.poc-validation.
>
> WIll the logs still get mixed up?

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
If you run both programs in the same JVM then there can be only 1
SBFILENAME value and if both processes set it than 1 will overwrite
the value of the other.  I would suggest using 2 different system
properties.

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> Yes. thats correct. The log files get mixed up for POC-PROCESS and POC-VALIDATION. But i set different file names for them dynamically. For eg: In the case of POC-PROCESS, it will be like : log.poc-process.<datetimestamp>
>
>   and for POC-VALIDATION, it is like : log.poc-validation.<datetimestamp>
>
>   WIll the logs still get mixed up?

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
POC-VALIDATION and POC-PROCESS use the same filename and it isn't
supported to have two appenders use the same file.  Is that the file
where you get the mixed logs?

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> This is my config file :
>
>   # Configuration file for the logging properties.
> # The log level hierarchy for log4j is DEBUG < INFO < WARN < ERROR < FATAL
> # The name of the logger specified below should be passed as a parameter
> # while instantiating the logger.
>   log4j.logger.RAPID = DEBUG, SMTPRAPID, RAPID, RAPIDROLL
> log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
> log4j.logger.POC-PROCESS = DEBUG, POC-PROCESS, SMTPPOC-PROCESS
>
> ############# LOGGING FOR RAPID ################
>   #RAPID ROLLING FILE LOGS
> log4j.appender.RAPIDROLL=org.apache.log4j.RollingFileAppender
> log4j.appender.RAPIDROLL.File=/home/test/log/rapid.log
> log4j.appender.RAPIDROLL.Append = true
> log4j.appender.RAPIDROLL.maxBackupIndex=10
> log4j.appender.RAPIDROLL.maxFileSize=1MB
> log4j.appender.RAPIDROLL.layout=org.apache.log4j.PatternLayout
> log4j.appender.RAPIDROLL.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %x - %m%n
>
> # SMTPRAPID is set to be a SMTPAppender.
> log4j.appender.SMTPRAPID = org.apache.log4j.net.SMTPAppender
> log4j.appender.SMTPRAPID.To = abc@xyz.com
> log4j.appender.SMTPRAPID.Subject = "Smartbuy --> RAPID"
> log4j.appender.SMTPRAPID.BufferSize = 1024
> log4j.appender.SMTPRAPID.Threshold = WARN
> log4j.appender.SMTPRAPID.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
> log4j.appender.SMTPRAPID.layout = com.hp.sb.interfaces.util.MailLayout
>
> ############# LOGGING FOR  POCLOSE - VALIDATION ################
>   ##POClose Validation Logs
>   log4j.appender.POC-VALIDATION=org.apache.log4j.FileAppender
> log4j.appender.POC-VALIDATION.File=/home/test/log/${SBFILENAME}
> log4j.appender.POC-VALIDATION.Append = false
> log4j.appender.POC-VALIDATION.layout=org.apache.log4j.PatternLayout
> log4j.appender.POC-VALIDATION.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %x - %m%n
>
> # SMTPPOXML is set to be a SMTPAppender.
> log4j.appender.SMTPPOC-VALIDATION= org.apache.log4j.net.SMTPAppender
> log4j.appender.SMTPPOC-VALIDATION.To = abc@xyz.com
> log4j.appender.SMTPPOC-VALIDATION.Subject = "PO CLOSE VALIDATION"
> log4j.appender.SMTPPOC-VALIDATION.BufferSize = 1024
> log4j.appender.SMTPPOC-VALIDATION.Threshold = DEBUG
> log4j.appender.SMTPPOC-VALIDATION.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
> log4j.appender.SMTPPOC-VALIDATION.layout = com.hp.sb.interfaces.util.MailLayout
>   ############# LOGGING FOR  POCLOSE - PROCESS ################
>   ##POClose Validation Logs
>   log4j.appender.POC-PROCESS=org.apache.log4j.FileAppender
> log4j.appender.POC-PROCESS.File=/home/test/log/${SBFILENAME}
> log4j.appender.POC-PROCESS.Append = false
> log4j.appender.POC-PROCESS.layout=org.apache.log4j.PatternLayout
> log4j.appender.POC-PROCESS.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %x - %m%n
>
> # SMTPPOXML is set to be a SMTPAppender.
> log4j.appender.SMTPPOC-PROCESS= org.apache.log4j.net.SMTPAppender
> log4j.appender.SMTPPOC-PROCESS.To = abc@xyz.com
> log4j.appender.SMTPPOC-PROCESS.Subject = "PO CLOSE PROCESS"
> log4j.appender.SMTPPOC-PROCESS.BufferSize = 1024
> log4j.appender.SMTPPOC-PROCESS.Threshold = DEBUG
> log4j.appender.SMTPPOC-PROCESS.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
> log4j.appender.SMTPPOC-PROCESS.layout = com.hp.sb.interfaces.util.MailLayout
>
>
> James Stauffer <st...@gmail.com> wrote:
>   Can you send your complete config file? What are the various
> pScriptName values used? It appears that you are sending everything
> to both appenders and that is why you get things mixed.
>
> On 4/27/06, Vin Karthik wrote:
> > Here is the logger definition :
> >
> > log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
> >
> > I do Logger.getLogger(pScriptName) also. But i still do this caching in addition to it. When i dont specify the log directory for 1 program, it puts the logs of the program in the other program's log file. This is another issue which i face.
> >
> > James Stauffer wrote:
> > If you call Logger.getLogger() twice with the same parameter then the
> > same instance will be returned so there is no need to cache it.
> >
> > On 4/27/06, Vin Karthik wrote:
> > > I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.
> >
> > --
> > James Stauffer
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
> > ---------------------------------
> > New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
This is my config file : 
   
  # Configuration file for the logging properties.
# The log level hierarchy for log4j is DEBUG < INFO < WARN < ERROR < FATAL
# The name of the logger specified below should be passed as a parameter 
# while instantiating the logger.
  log4j.logger.RAPID = DEBUG, SMTPRAPID, RAPID, RAPIDROLL
log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
log4j.logger.POC-PROCESS = DEBUG, POC-PROCESS, SMTPPOC-PROCESS
  
############# LOGGING FOR RAPID ################
  #RAPID ROLLING FILE LOGS
log4j.appender.RAPIDROLL=org.apache.log4j.RollingFileAppender
log4j.appender.RAPIDROLL.File=/home/test/log/rapid.log
log4j.appender.RAPIDROLL.Append = true
log4j.appender.RAPIDROLL.maxBackupIndex=10
log4j.appender.RAPIDROLL.maxFileSize=1MB
log4j.appender.RAPIDROLL.layout=org.apache.log4j.PatternLayout
log4j.appender.RAPIDROLL.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %x - %m%n 
  
# SMTPRAPID is set to be a SMTPAppender.
log4j.appender.SMTPRAPID = org.apache.log4j.net.SMTPAppender
log4j.appender.SMTPRAPID.To = abc@xyz.com
log4j.appender.SMTPRAPID.Subject = "Smartbuy --> RAPID"
log4j.appender.SMTPRAPID.BufferSize = 1024
log4j.appender.SMTPRAPID.Threshold = WARN
log4j.appender.SMTPRAPID.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
log4j.appender.SMTPRAPID.layout = com.hp.sb.interfaces.util.MailLayout
  
############# LOGGING FOR  POCLOSE - VALIDATION ################
  ##POClose Validation Logs
  log4j.appender.POC-VALIDATION=org.apache.log4j.FileAppender
log4j.appender.POC-VALIDATION.File=/home/test/log/${SBFILENAME}
log4j.appender.POC-VALIDATION.Append = false
log4j.appender.POC-VALIDATION.layout=org.apache.log4j.PatternLayout
log4j.appender.POC-VALIDATION.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %x - %m%n
  
# SMTPPOXML is set to be a SMTPAppender.
log4j.appender.SMTPPOC-VALIDATION= org.apache.log4j.net.SMTPAppender
log4j.appender.SMTPPOC-VALIDATION.To = abc@xyz.com
log4j.appender.SMTPPOC-VALIDATION.Subject = "PO CLOSE VALIDATION"
log4j.appender.SMTPPOC-VALIDATION.BufferSize = 1024
log4j.appender.SMTPPOC-VALIDATION.Threshold = DEBUG
log4j.appender.SMTPPOC-VALIDATION.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
log4j.appender.SMTPPOC-VALIDATION.layout = com.hp.sb.interfaces.util.MailLayout
  ############# LOGGING FOR  POCLOSE - PROCESS ################
  ##POClose Validation Logs
  log4j.appender.POC-PROCESS=org.apache.log4j.FileAppender
log4j.appender.POC-PROCESS.File=/home/test/log/${SBFILENAME}
log4j.appender.POC-PROCESS.Append = false
log4j.appender.POC-PROCESS.layout=org.apache.log4j.PatternLayout
log4j.appender.POC-PROCESS.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %x - %m%n
  
# SMTPPOXML is set to be a SMTPAppender.
log4j.appender.SMTPPOC-PROCESS= org.apache.log4j.net.SMTPAppender
log4j.appender.SMTPPOC-PROCESS.To = abc@xyz.com
log4j.appender.SMTPPOC-PROCESS.Subject = "PO CLOSE PROCESS"
log4j.appender.SMTPPOC-PROCESS.BufferSize = 1024
log4j.appender.SMTPPOC-PROCESS.Threshold = DEBUG
log4j.appender.SMTPPOC-PROCESS.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
log4j.appender.SMTPPOC-PROCESS.layout = com.hp.sb.interfaces.util.MailLayout
   
  
James Stauffer <st...@gmail.com> wrote:
  Can you send your complete config file? What are the various
pScriptName values used? It appears that you are sending everything
to both appenders and that is why you get things mixed.

On 4/27/06, Vin Karthik wrote:
> Here is the logger definition :
>
> log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
>
> I do Logger.getLogger(pScriptName) also. But i still do this caching in addition to it. When i dont specify the log directory for 1 program, it puts the logs of the program in the other program's log file. This is another issue which i face.
>
> James Stauffer wrote:
> If you call Logger.getLogger() twice with the same parameter then the
> same instance will be returned so there is no need to cache it.
>
> On 4/27/06, Vin Karthik wrote:
> > I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
Yes. thats correct. The log files get mixed up for POC-PROCESS and POC-VALIDATION. But i set different file names for them dynamically. For eg: In the case of POC-PROCESS, it will be like : log.poc-process.<datetimestamp>
   
  and for POC-VALIDATION, it is like : log.poc-validation.<datetimestamp>
   
  WIll the logs still get mixed up?

James Stauffer <st...@gmail.com> wrote:
  Can you send your complete config file? What are the various
pScriptName values used? It appears that you are sending everything
to both appenders and that is why you get things mixed.

On 4/27/06, Vin Karthik wrote:
> Here is the logger definition :
>
> log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
>
> I do Logger.getLogger(pScriptName) also. But i still do this caching in addition to it. When i dont specify the log directory for 1 program, it puts the logs of the program in the other program's log file. This is another issue which i face.
>
> James Stauffer wrote:
> If you call Logger.getLogger() twice with the same parameter then the
> same instance will be returned so there is no need to cache it.
>
> On 4/27/06, Vin Karthik wrote:
> > I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
Can you send your complete config file?  What are the various
pScriptName values used?  It appears that you are sending everything
to both appenders and that is why you get things mixed.

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> Here is the logger definition :
>
>   log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
>
>   I do Logger.getLogger(pScriptName) also. But i still do this caching in addition to it. When i dont specify the log directory for 1 program, it puts the logs of the program in the other program's log file. This is another issue which i face.
>
> James Stauffer <st...@gmail.com> wrote:
>   If you call Logger.getLogger() twice with the same parameter then the
> same instance will be returned so there is no need to cache it.
>
> On 4/27/06, Vin Karthik wrote:
> > I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
Here is the logger definition : 
   
  log4j.logger.POC-VALIDATION = DEBUG, POC-VALIDATION, SMTPPOC-VALIDATION
   
  I do Logger.getLogger(pScriptName) also. But i still do this caching in addition to it. When i dont specify the log directory for 1 program, it puts the logs of the program in the other program's log file. This is another issue which i face.

James Stauffer <st...@gmail.com> wrote:
  If you call Logger.getLogger() twice with the same parameter then the
same instance will be returned so there is no need to cache it.

On 4/27/06, Vin Karthik wrote:
> I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
If you call Logger.getLogger() twice with the same parameter then the
same instance will be returned so there is no need to cache it.

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
>   I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
The config file is as follows : 
   
  ##POClose Validation Logs
  log4j.appender.POC-VALIDATION=org.apache.log4j.FileAppender
log4j.appender.POC-VALIDATION.File=/home/test/log/${FILENAME}
log4j.appender.POC-VALIDATION.Append = false
log4j.appender.POC-VALIDATION.layout=org.apache.log4j.PatternLayout
log4j.appender.POC-VALIDATION.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %x - %m%n
  
# SMTPPOXML is set to be a SMTPAppender.
log4j.appender.SMTPPOC-VALIDATION= org.apache.log4j.net.SMTPAppender
log4j.appender.SMTPPOC-VALIDATION.To = abc@xyz.com
  log4j.appender.SMTPPOC-VALIDATION.Subject = "PO CLOSE VALIDATION"
log4j.appender.SMTPPOC-VALIDATION.BufferSize = 1024
log4j.appender.SMTPPOC-VALIDATION.Threshold = DEBUG
log4j.appender.SMTPPOC-VALIDATION.EvaluatorClass = com.hp.sb.interfaces.util.MailTrigger
log4j.appender.SMTPPOC-VALIDATION.layout = com.hp.sb.interfaces.util.MailLayout
   
  I do a System set Property for the log file name and create them dynamically. I cache the logging instance so that the same program whihc is invoking the logger for the same instance the second time. The pScriptName variable is the name of the program invoking the logger.

James Stauffer <st...@gmail.com> wrote:
  Post your config.
Also, It appears that you are caching Logger instances. Why are you doing that?

On 4/27/06, Vin Karthik wrote:
> I missed few details in the previous mail.
>
> public static Hashtable mht = new Hashtable()
>
> mLogger is the class member variable.
>
> Vin Karthik wrote:
> Hi,
>
> I am facing a problem with log4j. I am running 2 seperate programs. Both the programs use different log files 1.txt and 2.txt respectively. When these programs(1 & 2) are run continuously, the log statements get logged in the same log file(1.txt). The logger instantiation piece of code is as follows :
>
> public static Logger getLogInstance(String pScriptName)
> {
> if(mht.get(pScriptName) != null)
> {
> mLogger = (Logger) mht.get(pScriptName);
> }
> else
> {
> mLogger = Logger.getInstance(pScriptName);
> mht.put(pScriptName,mLogger);
> }
> return mLogger;
> }
>
> The pScriptName variable is Unique. Not really sure why this is happening.
>
> Can someone please help me on this.
>
> Thanks
> Karthik
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



			
---------------------------------
Yahoo! Mail goes everywhere you do.  Get it on your phone.
		
---------------------------------
Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.

Re: Log statements getting mingled in one log file

Posted by James Stauffer <st...@gmail.com>.
Post your config.
Also, It appears that you are caching Logger instances.  Why are you doing that?

On 4/27/06, Vin Karthik <vi...@yahoo.com> wrote:
> I missed few details in the previous mail.
>
>   public static Hashtable mht = new Hashtable()
>
>   mLogger is the class member variable.
>
> Vin Karthik <vi...@yahoo.com> wrote:
>   Hi,
>
> I am facing a problem with log4j. I am running 2 seperate programs. Both the programs use different log files 1.txt and 2.txt respectively. When these programs(1 & 2) are run continuously, the log statements get logged in the same log file(1.txt). The logger instantiation piece of code is as follows :
>
> public static Logger getLogInstance(String pScriptName)
> {
> if(mht.get(pScriptName) != null)
> {
> mLogger = (Logger) mht.get(pScriptName);
> }
> else
> {
> mLogger = Logger.getInstance(pScriptName);
> mht.put(pScriptName,mLogger);
> }
> return mLogger;
> }
>
> The pScriptName variable is Unique. Not really sure why this is happening.
>
> Can someone please help me on this.
>
> Thanks
> Karthik
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call rates.
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log statements getting mingled in one log file

Posted by Vin Karthik <vi...@yahoo.com>.
I missed few details in the previous mail.
   
  public static Hashtable mht = new Hashtable()

  mLogger is the class member variable.
  
Vin Karthik <vi...@yahoo.com> wrote:
  Hi,

I am facing a problem with log4j. I am running 2 seperate programs. Both the programs use different log files 1.txt and 2.txt respectively. When these programs(1 & 2) are run continuously, the log statements get logged in the same log file(1.txt). The logger instantiation piece of code is as follows : 

public static Logger getLogInstance(String pScriptName)
{
if(mht.get(pScriptName) != null)
{
mLogger = (Logger) mht.get(pScriptName);
}
else
{
mLogger = Logger.getInstance(pScriptName);
mht.put(pScriptName,mLogger); 
}
return mLogger;
}

The pScriptName variable is Unique. Not really sure why this is happening.

Can someone please help me on this.

Thanks
Karthik


---------------------------------
How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.