RE: Help for starter..

2003-01-27 Thread Madhava Reddy

>>I have another concern about our application maintaining conncetion pool
>>and logger maintaining separate connection.

>>what we expect is the logger to use either exisitng connection form pool
or
>>use the DAO layer itself.
>>
>>Can you help me how to proceed with that? Pls come with Any comments or
>>suggestions of any kind regarding the same

If you intend to maintain a pool of Loggers.. it is no need.

Rich has already told how to make use of loggers in java. Find attachments.

regards
Madhav



Amandeep Midha (CHARMIE)
IT Solutions (India) Pvt. Ltd.
No. 17, South End Road,
Basavanudi
Bangalore - 560 004. India
TEL : 91-80-6657180 EXT: 2117
MOBILE: +919844048126 (Upto March 12, 2003)
FAX: 91-80-6655755
-
Visit my site @ http://newdelhi.topcities.com
-



 

Madhava Reddy

 
n-scm.com>   cc:

             Subject: RE: Help for
starter..
01/27/2003 12:31

AM

Please respond to

"Log4J Users List"

 

 





Hi Mark and Rich,

Thanks for the help.. It's working fine now.

Madhav


-Original Message-
From: Rich Bagley [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 25, 2003 8:47 PM
To: Log4J Users List
Subject: RE: Help for starter..


Hi,

  I think the second xml is overwriting the appender attached to root.  I'd
use one xml file, with multiple appenders and loggers, something like this:




http://jakarta.apache.org/log4j/";>































  In your code:

 //  Initialize the config
 //
 DOMConfigurator.configure(
"java/samples/xml/multiple/multi.xml" );

 //  Get the loggers
 //
 Logger requestLogger = Logger.getLogger
( "logging.request"
);
 Logger dailyLogger = Logger.getLogger
( "logging.dailyLog" );

 //  Write to the logs
 //
requestLogger.debug( "request message1: DEBUG" );
requestLogger.info( "request message2: INFO" );

dailyLogger.debug( "dailyLog message1: DEBUG" );
dailyLogger.info( "dailyLog message2: INFO" );

  You'll get two log files.

  I've attached the xml file and a test class.

Hope this helps
-Rich


>> -Original Message-
>> From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, January 25, 2003 12:07 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: Help for starter..
>>
>>
>> Hi,
>>
>> I'm fairly new to this Log4j.
>>
>> I have several questions.
>>
>> I am using Tomcat. I have jsps and java files. I planned to use 3 logs.
I
>> want to maintain Logs to Track Login Time, Logout Time in one log.
Second
>> log tracks Critical Requsts of all users. Third log tracks Exceptions
and
>> errors for all users.
>>
>> So, I am using DailyRollingFileAppender for these 3 logs. I am
>> configuring
>> logger by an xml file.
>>
>> Here is Loggin Track xml file. Login.xml
>> 
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
>>  
>> 
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> ---
>>
>> and Request Track xml File
>>
>> --
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/>
>>  
>> 
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> -
>>
>> I create loggers in my java, like
>>
>> To get Login Track logger
>>
>

RE: Help for starter..

2003-01-26 Thread Amandeep Midha

Hi all,

It was a great help from Rich.

I have another concern about our application maintaining conncetion pool
and logger maintaining separate connection.

what we expect is the logger to use either exisitng connection form pool or
use the DAO layer itself.

Can you help me how to proceed with that? Pls come with Any comments or
suggestions of any kind regarding the same

regards,
Amandeep




-
Amandeep Midha (CHARMIE)
IT Solutions (India) Pvt. Ltd.
No. 17, South End Road,
Basavanudi
Bangalore - 560 004. India
TEL : 91-80-6657180 EXT: 2117
MOBILE: +919844048126 (Upto March 12, 2003)
FAX: 91-80-6655755
-
Visit my site @ http://newdelhi.topcities.com
-



   
 
Madhava Reddy  
 
 
n-scm.com>   cc:   
 
 Subject:     RE: Help for starter..   
 
01/27/2003 12:31   
 
AM 
 
Please respond to  
 
"Log4J Users List" 
 
   
 
   
 




Hi Mark and Rich,

Thanks for the help.. It's working fine now.

Madhav


-Original Message-
From: Rich Bagley [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 25, 2003 8:47 PM
To: Log4J Users List
Subject: RE: Help for starter..


Hi,

  I think the second xml is overwriting the appender attached to root.  I'd
use one xml file, with multiple appenders and loggers, something like this:




http://jakarta.apache.org/log4j/";>































  In your code:

 //  Initialize the config
 //
 DOMConfigurator.configure(
"java/samples/xml/multiple/multi.xml" );

 //  Get the loggers
 //
 Logger requestLogger = Logger.getLogger
( "logging.request"
);
 Logger dailyLogger = Logger.getLogger
( "logging.dailyLog" );

 //  Write to the logs
 //
requestLogger.debug( "request message1: DEBUG" );
requestLogger.info( "request message2: INFO" );

dailyLogger.debug( "dailyLog message1: DEBUG" );
dailyLogger.info( "dailyLog message2: INFO" );

  You'll get two log files.

  I've attached the xml file and a test class.

Hope this helps
-Rich


>> -Original Message-
>> From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, January 25, 2003 12:07 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: Help for starter..
>>
>>
>> Hi,
>>
>> I'm fairly new to this Log4j.
>>
>> I have several questions.
>>
>> I am using Tomcat. I have jsps and java files. I planned to use 3 logs.
I
>> want to maintain Logs to Track Login Time, Logout Time in one log.
Second
>> log tracks Critical Requsts of all users. Third log tracks Exceptions
and
>> errors for all users.
>>
>> So, I am using DailyRollingFileAppender for these 3 logs. I am
>> configuring
>> logger by an xml file.
>>
>> Here is Loggin Track xml file. Login.xml
>> 
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
>>  
>> 
>&g

RE: Help for starter..

2003-01-26 Thread Madhava Reddy
Hi Mark and Rich,

Thanks for the help.. It's working fine now. 

Madhav


-Original Message-
From: Rich Bagley [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 25, 2003 8:47 PM
To: Log4J Users List
Subject: RE: Help for starter.. 


Hi,

  I think the second xml is overwriting the appender attached to root.  I'd
use one xml file, with multiple appenders and loggers, something like this:




http://jakarta.apache.org/log4j/";>































  In your code:

//  Initialize the config
//
DOMConfigurator.configure(
"java/samples/xml/multiple/multi.xml" );

//  Get the loggers
//
Logger requestLogger = Logger.getLogger( "logging.request"
);
Logger dailyLogger = Logger.getLogger( "logging.dailyLog" );

//  Write to the logs
//
requestLogger.debug( "request message1: DEBUG" );
requestLogger.info( "request message2: INFO" );

dailyLogger.debug( "dailyLog message1: DEBUG" );
dailyLogger.info( "dailyLog message2: INFO" );

  You'll get two log files.

  I've attached the xml file and a test class.

Hope this helps
-Rich


>> -Original Message-
>> From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, January 25, 2003 12:07 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: Help for starter..
>>
>>
>> Hi,
>>
>> I'm fairly new to this Log4j.
>>
>> I have several questions.
>>
>> I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I
>> want to maintain Logs to Track Login Time, Logout Time in one log. Second
>> log tracks Critical Requsts of all users. Third log tracks Exceptions and
>> errors for all users.
>>
>> So, I am using DailyRollingFileAppender for these 3 logs. I am
>> configuring
>> logger by an xml file.
>>
>> Here is Loggin Track xml file. Login.xml
>> 
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
>>  
>>  
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> ---
>>
>> and Request Track xml File
>>
>> --
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/>
>>  
>>  
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> -
>>
>> I create loggers in my java, like
>>
>> To get Login Track logger
>>
>> org.apache.log4j.xml.DOMConfigurator.configure("Login.xml");
>>
>> Logger loginLog = org.apache.log4j.Logger.getLogger("Login");
>>
>> and to get Request Logger
>>
>> org.apache.log4j.xml.DOMConfigurator.configure("Request.xml");
>>
>> Logger requestLog = org.apache.log4j.Logger.getLogger("Request");
>>
>> --
>>
>> When I use these logs like
>>
>> loginLog.debug("Testing Login Track ");
>> requestLog.debug(" Testing Request Track" );
>>
>> ---
>>
>> I'm getting two log files namely LoginTrack.log and
>> RequestTrack.log. But,
>> LoginTrack is empty and RequestTrack.log contains,
>>
>> 2003-01-25 17:54:57,486 DEBUG   Testing Login Track
>> 2003-01-25 17:54:57,486 DEBUGTesting Request Log
>>
>> which means I am getting the same reference for the two loggers. What
>> mistake I've done? How to get 2 different instances?
>>
>> 
>> I receive the name of Logger as argument in Java, if I have created this
>> log, return existing, else I will create new logger and return. I will
>> maintain loggers mapping looger name -- logger.
>>
>> Please point out any mistakes or wrong apprach in the above
>> approach. Will
>> this approach creates some problems at some later poing of time?
>>
>> ---
>>
>> One more question,
>>
>> Imagine, I have successfully running tomcat with these loggers.
>> After some
>> days, the loggers size may become critical. I observed that, I can not
>> delete a log file with out stopping tomcat.. How to delete old
>> log files?
>>
>> I have more questions too.. but those are more related to Tomcat
>> than Log4j.
>> I will share those later.
>>
>> thanks for your advice..
>>
>> Madhav
>>
>>



RE: Help for starter..

2003-01-25 Thread Rich Bagley
Hi,

  I think the second xml is overwriting the appender attached to root.  I'd
use one xml file, with multiple appenders and loggers, something like this:




http://jakarta.apache.org/log4j/";>































  In your code:

//  Initialize the config
//
DOMConfigurator.configure( "java/samples/xml/multiple/multi.xml" );

//  Get the loggers
//
Logger requestLogger = Logger.getLogger( "logging.request" );
Logger dailyLogger = Logger.getLogger( "logging.dailyLog" );

//  Write to the logs
//
requestLogger.debug( "request message1: DEBUG" );
requestLogger.info( "request message2: INFO" );

dailyLogger.debug( "dailyLog message1: DEBUG" );
dailyLogger.info( "dailyLog message2: INFO" );

  You'll get two log files.

  I've attached the xml file and a test class.

Hope this helps
-Rich


>> -Original Message-
>> From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, January 25, 2003 12:07 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: Help for starter..
>>
>>
>> Hi,
>>
>> I'm fairly new to this Log4j.
>>
>> I have several questions.
>>
>> I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I
>> want to maintain Logs to Track Login Time, Logout Time in one log. Second
>> log tracks Critical Requsts of all users. Third log tracks Exceptions and
>> errors for all users.
>>
>> So, I am using DailyRollingFileAppender for these 3 logs. I am
>> configuring
>> logger by an xml file.
>>
>> Here is Loggin Track xml file. Login.xml
>> 
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
>>  
>>  
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> ---
>>
>> and Request Track xml File
>>
>> --
>> 
>> 
>>
>> http://jakarta.apache.org/log4j/";>
>>
>>  > class="org.apache.log4j.DailyRollingFileAppender">
>>  > value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/>
>>  
>>  
>>  
>>  
>>
>>  
>>  
>>  
>>  
>> 
>> -
>>
>> I create loggers in my java, like
>>
>> To get Login Track logger
>>
>> org.apache.log4j.xml.DOMConfigurator.configure("Login.xml");
>>
>> Logger loginLog = org.apache.log4j.Logger.getLogger("Login");
>>
>> and to get Request Logger
>>
>> org.apache.log4j.xml.DOMConfigurator.configure("Request.xml");
>>
>> Logger requestLog = org.apache.log4j.Logger.getLogger("Request");
>>
>> --
>>
>> When I use these logs like
>>
>> loginLog.debug("Testing Login Track ");
>> requestLog.debug(" Testing Request Track" );
>>
>> ---
>>
>> I'm getting two log files namely LoginTrack.log and
>> RequestTrack.log. But,
>> LoginTrack is empty and RequestTrack.log contains,
>>
>> 2003-01-25 17:54:57,486 DEBUG   Testing Login Track
>> 2003-01-25 17:54:57,486 DEBUGTesting Request Log
>>
>> which means I am getting the same reference for the two loggers. What
>> mistake I've done? How to get 2 different instances?
>>
>> 
>> I receive the name of Logger as argument in Java, if I have created this
>> log, return existing, else I will create new logger and return. I will
>> maintain loggers mapping looger name -- logger.
>>
>> Please point out any mistakes or wrong apprach in the above
>> approach. Will
>> this approach creates some problems at some later poing of time?
>>
>> ---
>>
>> One more question,
>>
>> Imagine, I have successfully running tomcat with these loggers.
>> After some
>> days, the loggers size may become critical. I observed that, I can not
>> delete a log file with out stopping tomcat.. How to delete old
>> log files?
>>
>> I have more questions too.. but those are more related to Tomcat
>> than Log4j.
>> I will share those later.
>>
>> thanks for your advice..
>>
>> Madhav
>>
>>




http://jakarta.apache.org/log4j/";>
































LoggerTest.java
Description: Binary data
--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


RE: Help for starter..

2003-01-25 Thread Mark Womack
Sorry, mistake in my xml.  Try this instead:


  
  



  
  


You can tell how often I actually change additivity.  As penance I shall
update the section in the wiki faq about the logger format.  :-)

-Mark

> -Original Message-
> From: Mark Womack 
> Sent: Saturday, January 25, 2003 10:18 AM
> To: 'Log4J Users List'
> Subject: RE: Help for starter.. 
> 
> 
> Configuring log4j with 2 or 3 different configuration files, the last
> configuration file will be in affect.  You should probably combine the
> configuration files into a single file, and then add the following:
> 
> 
>   
>   
>   
> 
> 
> 
>   
>   
> 
> 
> This makes it so that the logger "Request" only logs messges 
> to the appender
> "Request".  Everything else is logged to "DailyLog".
> 
> Though it is not yet complete, I also recommend looking at the wiki
> documentation on xml configuration format located at:
> 
> http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JXmlFormat
> 
> We need a faq for DailyRollingAppender, etc.  Anyone want to 
> post a working
> example, or better yet, add the page to wiki?
> 
> -Mark
> 
> > -Original Message-
> > From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, January 25, 2003 9:07 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: Help for starter.. 
> > 
> > 
> > Hi,
> > 
> > I'm fairly new to this Log4j.
> > 
> > I have several questions. 
> > 
> > I am using Tomcat. I have jsps and java files. I planned to 
> > use 3 logs. I
> > want to maintain Logs to Track Login Time, Logout Time in one 
> > log. Second
> > log tracks Critical Requsts of all users. Third log tracks 
> > Exceptions and
> > errors for all users.
> > 
> > So, I am using DailyRollingFileAppender for these 3 logs. I 
> > am configuring
> > logger by an xml file.
> > 
> > Here is Loggin Track xml file. Login.xml
> > 
> > 
> > 
> > 
> > http://jakarta.apache.org/log4j/";>
> > 
> >   > class="org.apache.log4j.DailyRollingFileAppender">
> >   > value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
> >  
> > 
> >  
> >  
> > 
> >  
> >  
> >  
> >  
> > 
> > ---
> > 
> > and Request Track xml File
> > 
> > --
> > 
> > 
> > 
> > http://jakarta.apache.org/log4j/";>
> > 
> >   > class="org.apache.log4j.DailyRollingFileAppender">
> >   > value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/>
> >  
> > 
> >  
> >  
> > 
> >  
> >  
> >  
> >  
> > 
> > -
> > 
> > I create loggers in my java, like
> > 
> > To get Login Track logger
> > 
> > org.apache.log4j.xml.DOMConfigurator.configure("Login.xml");
> > 
> > Logger loginLog = org.apache.log4j.Logger.getLogger("Login");
> > 
> > and to get Request Logger
> > 
> > org.apache.log4j.xml.DOMConfigurator.configure("Request.xml");
> > 
> > Logger requestLog = org.apache.log4j.Logger.getLogger("Request");
> > 
> > --
> > 
> > When I use these logs like
> > 
> > loginLog.debug("Testing Login Track ");
> > requestLog.debug(" Testing Request Track" );
> > 
> > --- 
> > 
> > I'm getting two log files namely LoginTrack.log and 
> > RequestTrack.log. But,
> > LoginTrack is empty and RequestTrack.log contains,
> > 
> > 2003-01-25 17:54:57,486 DEBUG   Testing Login Track
> > 2003-01-25 17:54:57,486 DEBUGTesting Request Log
> > 
> > which means I am getting the same reference for the two 
> loggers. What
> > mistake I've done? How to get 2 different instances?
> > 
> > 
> > I receive the name of Logger as argument in Java, if I have 
> > created this
> > log, return existing, else I will create new logger and 
> return. I will
> > maintain loggers mapping looger name -- logger. 
> > 
> > Please point out any mistakes or wrong apprach in the above 
> > approach. Will
> > this approach creates some problems at some later poing of time? 
> > 
> > --- 
> > 
> > One more question,
> > 
> > Imagine, I have successfully running tomcat with these 
> > loggers. After some
> > days, the loggers size may become critical. I observed 
> that, I can not
> > delete a log file with out stopping tomcat.. How to delete 
> > old log files? 
> > 
> > I have more questions too.. but those are more related to 
> > Tomcat than Log4j.
> > I will share those later.
> > 
> > thanks for your advice..
> > 
> > Madhav
> > 
> > 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Help for starter..

2003-01-25 Thread Mark Womack
Configuring log4j with 2 or 3 different configuration files, the last
configuration file will be in affect.  You should probably combine the
configuration files into a single file, and then add the following:


  
  
  



  
  


This makes it so that the logger "Request" only logs messges to the appender
"Request".  Everything else is logged to "DailyLog".

Though it is not yet complete, I also recommend looking at the wiki
documentation on xml configuration format located at:

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JXmlFormat

We need a faq for DailyRollingAppender, etc.  Anyone want to post a working
example, or better yet, add the page to wiki?

-Mark

> -Original Message-
> From: Madhava Reddy [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, January 25, 2003 9:07 AM
> To: '[EMAIL PROTECTED]'
> Subject: Help for starter.. 
> 
> 
> Hi,
> 
> I'm fairly new to this Log4j.
> 
> I have several questions. 
> 
> I am using Tomcat. I have jsps and java files. I planned to 
> use 3 logs. I
> want to maintain Logs to Track Login Time, Logout Time in one 
> log. Second
> log tracks Critical Requsts of all users. Third log tracks 
> Exceptions and
> errors for all users.
> 
> So, I am using DailyRollingFileAppender for these 3 logs. I 
> am configuring
> logger by an xml file.
> 
> Here is Loggin Track xml file. Login.xml
> 
> 
> 
> 
> http://jakarta.apache.org/log4j/";>
> 
>   class="org.apache.log4j.DailyRollingFileAppender">
>   value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/>
>  
>   
>  
>  
> 
>  
>  
>  
>  
> 
> ---
> 
> and Request Track xml File
> 
> --
> 
> 
> 
> http://jakarta.apache.org/log4j/";>
> 
>   class="org.apache.log4j.DailyRollingFileAppender">
>   value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/>
>  
>   
>  
>  
> 
>  
>  
>  
>  
> 
> -
> 
> I create loggers in my java, like
> 
> To get Login Track logger
> 
> org.apache.log4j.xml.DOMConfigurator.configure("Login.xml");
> 
> Logger loginLog = org.apache.log4j.Logger.getLogger("Login");
> 
> and to get Request Logger
> 
> org.apache.log4j.xml.DOMConfigurator.configure("Request.xml");
> 
> Logger requestLog = org.apache.log4j.Logger.getLogger("Request");
> 
> --
> 
> When I use these logs like
> 
> loginLog.debug("Testing Login Track ");
> requestLog.debug(" Testing Request Track" );
> 
> --- 
> 
> I'm getting two log files namely LoginTrack.log and 
> RequestTrack.log. But,
> LoginTrack is empty and RequestTrack.log contains,
> 
> 2003-01-25 17:54:57,486 DEBUG   Testing Login Track
> 2003-01-25 17:54:57,486 DEBUGTesting Request Log
> 
> which means I am getting the same reference for the two loggers. What
> mistake I've done? How to get 2 different instances?
> 
> 
> I receive the name of Logger as argument in Java, if I have 
> created this
> log, return existing, else I will create new logger and return. I will
> maintain loggers mapping looger name -- logger. 
> 
> Please point out any mistakes or wrong apprach in the above 
> approach. Will
> this approach creates some problems at some later poing of time? 
> 
> --- 
> 
> One more question,
> 
> Imagine, I have successfully running tomcat with these 
> loggers. After some
> days, the loggers size may become critical. I observed that, I can not
> delete a log file with out stopping tomcat.. How to delete 
> old log files? 
> 
> I have more questions too.. but those are more related to 
> Tomcat than Log4j.
> I will share those later.
> 
> thanks for your advice..
> 
> Madhav
> 
> 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: