Hi Ven-

when you make Log4j method calls there is a log4j.properties file (located on 
your classpath) Log4j uses to determine config params
I have attached a copy of my log4j.properties which I used in my last 
assignment -

# Set root logger level and appenders 
log4j.rootCategory=INFO, cblErrorLog, cblSMTP
 
# cblErrorLog is set to be a RollingFileAppender. 
# this is the log file for non-hospital specific errors
log4j.appender.cblErrorLog=org.apache.log4j.RollingFileAppender 
log4j.appender.cblErrorLog.MaxFileSize=10MB
log4j.appender.cblErrorLog.MaxBackupIndex=1
log4j.appender.cblErrorLog.File=/export/home/mgainty/batchloader/debug.log

# cblErrorLog uses PatternLayout. 
log4j.appender.cblErrorLog.layout=org.apache.log4j.PatternLayout 
log4j.appender.cblErrorLog.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

# cblSMTP is the mailer for serious errors only
log4j.appender.cblSMTP=org.apache.log4j.net.SMTPAppender
log4j.appender.cblSMTP.layout=org.apache.log4j.PatternLayout
log4j.appender.cblSMTP.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
log4j.appender.cblSMTP.Subject=BatchLoader Exception
log4j.appender.cblSMTP.SMTPHost=localhost
[EMAIL PROTECTED]
[EMAIL PROTECTED]
log4j.appender.cblSMTP.Threshold=ERROR

log4j.category.com.edischarge.batchloader.HospitalCategory=INFO, 
cblHospitalLog, cblSMTP
# cblHospitalLog is set to be a FileAppender. 

# this is the log file for HOSPITAL specific errors
log4j.appender.cblHospitalLog=org.apache.log4j.FileAppender 
log4j.appender.cblHospitalLog.File=/export/home/mgainty/batchloader/loader.log

# cblHospitalLog uses PatternLayout. 
log4j.appender.cblHospitalLog.layout=org.apache.log4j.PatternLayout 
log4j.appender.cblHospitalLog.layout.ConversionPattern=%-4r [%t] %-5p %c %x - 
%m%n

(Sorry about all the healthcare related items!)

java source 
import org.apache.log4j.Category; 
class FuBar {
//only 1 instance used by this class only so might as well go with private 
static
private static Category c_Category = Category.getInstance( 
FuBar.class.getName());

//actual invocation here of Category.error logic here
        if ( i_DataReader == null )
            {
            c_Category.error( "Reader cannot be null!!!" );
            throw new Exception( "Reader cannot be null!!!" );
            }

//Appender code
        //Build the layout for the appender
        java.lang.System.out.println("Adding PatternLayout for Hospital Pattern 
Layout"+m_sHospitalLogPattern);
        PatternLayout logPattern = new PatternLayout( m_sHospitalLogPattern );
        FileAppender hospitalFileAppender = new FileAppender( logPattern, 
hospitalLogFile.getAbsolutePath());

        // Now add the appender to the Category ..
        c_Category.addAppender( hospitalFileAppender );

HTH,
Martin-

--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of 
the individual or entity to which it is addressed and may contain information 
that is privileged, proprietary , confidential and exempt from disclosure. If 
you are not the intended recipient, you are notified that any dissemination, 
distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le 
cas échéant) s'adresse au destinataire indiqué et peut contenir des 
renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le 
destinataire de ce document, nous vous signalons qu'il est strictement interdit 
de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Venky Vasant" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Sunday, March 25, 2007 1:05 PM
Subject: Fw: tomcat as service with VM arguments


I have pretty much resolved all the exceptions by adding required jar files to 
class path
Now i dont get any exceptions but still tomacat does not start

How do i know now what is the issue???

Need help here

Regards
Venkat

----- Forwarded Message ----
From: Venky Vasant <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Friday, March 23, 2007 1:10:13 PM
Subject: Re: tomcat as service with VM arguments


and tomcat does not start
 
Venkat


----- Original Message ----
From: Venky Vasant <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Friday, March 23, 2007 12:56:15 PM
Subject: Re: tomcat as service with VM arguments


Hi Martin

I did that, i get this error in the log file


log4j:WARN No appenders could be found for logger 
(org.apache.catalina.startup.Bootstrap).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoSuchMethodException: 
org.apache.catalina.startup.Catalina.setAwait(boolean)
at java.lang.Class.getMethod(Unknown Source)
at org.apache.catalina.startup.Bootstrap.setAwait(Bootstrap.java:358)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)

Regards
Venkat


----- Original Message ----
From: Martin Gainty <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Friday, March 23, 2007 11:19:49 AM
Subject: Re: tomcat as service with VM arguments


Hi Ven-

(easier than I thought)

%TOMCAT_HOME%\bin\tomcat5w.exe
go to Java Tab (4th Tab from left)
3rd paragraph down you should see 'Java Options'
place all of your Java Options in that textfield

cmd
net stop Tomcat5
net start Tomcat5

HTH!
Martin--
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of 
the individual or entity to which it is addressed and may contain information 
that is privileged, proprietary , confidential and exempt from disclosure. If 
you are not the intended recipient, you are notified that any dissemination, 
distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le 
cas échéant) s'adresse au destinataire indiqué et peut contenir des 
renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le 
destinataire de ce document, nous vous signalons qu'il est strictement interdit 
de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Venky Vasant" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, March 23, 2007 1:09 PM
Subject: Re: tomcat as service with VM arguments


Thanks Martin
I will try this, but what i want is tomcat to start as a service and take all 
these options while it is starting up

Venkat



----- Original Message ----
From: Martin Gainty <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Thursday, March 22, 2007 6:31:04 PM
Subject: Re: tomcat as service with VM arguments


$TOMCAT_HOME/bin/java [Put All Java Options Here] -jar bootstrap.jar

M-
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of 
the individual or entity to which it is addressed and may contain information 
that is privileged, proprietary , confidential and exempt from disclosure. If 
you are not the intended recipient, you are notified that any dissemination, 
distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le 
cas échéant) s'adresse au destinataire indiqué et peut contenir des 
renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le 
destinataire de ce document, nous vous signalons qu'il est strictement interdit 
de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Venky Vasant" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Thursday, March 22, 2007 6:55 PM
Subject: Re: tomcat as service with VM arguments


> There is an arguments input field in properties window which is set to start
> i tried appending that with VM arguments it did not work 
> 
> Can some one throw some pointers to this
> 
> 
> ----- Original Message ----
> From: Venky Vasant <[EMAIL PROTECTED]>
> To: users@tomcat.apache.org
> Sent: Thursday, March 22, 2007 2:11:10 PM
> Subject: tomcat as service with VM arguments
> 
> 
> Hello
> 
> I need to start tomcat as service with VM arguments, let me know how do i 
> pass VM arguments.
> Previously i had this setup in Eclipse which provide two places in RUN Options
> one for Program Arguments and another for VM arguments.
> Now since i want this to start as soon as tomcat start as a service.
> 
> Thanks
> Venkat
> 
> 
> 
> ____________________________________________________________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives.
> http://tools.search.yahoo.com/toolbar/features/mail/
> 
> 
> 
> ____________________________________________________________________________________
> 8:00? 8:25? 8:40? Find a flick in no time 
> with the Yahoo! Search movie showtime shortcut.
> http://tools.search.yahoo.com/shortcuts/#news



____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/




____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091





8:00? 8:25? 8:40? Find a flick in no time
with theYahoo! Search movie showtime shortcut.


 
____________________________________________________________________________________
Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

Reply via email to