Logging to catalina logger
How do I produce log output to the catalina loggerwhen my program wants to print out some exceptions or messages? Any documents on this? Thanks -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logging to catalina logger
I dont know abt the cataline logger,I am using a small method I wrote and it is working fine right now. import java.io.FileWriter; import java.io.IOException; import java.util.Calendar; import java.util.TimeZone; public class Logger { static FileWriter out = null; static String filePath = ; public boolean pathFound =false; public void setPath(String path) { System.out.println(Path for logger set = + path); this.pathFound = true ; filePath = path; } synchronized public static void log(String message) { try { Calendar cal = Calendar.getInstance(TimeZone.getDefault()); String DATE_FORMAT = dd_MM_; java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT); if (out == null) { out = new FileWriter( filePath + ospLogs + sdf.format(cal.getTime()) + .txt, true); System.out.println( Path we made is = + filePath + ospLogs + sdf.format(cal.getTime()) + .txt); } out.write(message + \n); out.flush(); } catch (IOException e) { System.out.println( Caught IOException in logger = + e.getMessage()); } catch (Exception e) { System.out.println( Caught General Exception in logger + e.getMessage()); } } } - Original Message - From: Peter Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 01, 2002 8:05 PM Subject: Logging to catalina logger How do I produce log output to the catalina loggerwhen my program wants to print out some exceptions or messages? Any documents on this? Thanks -- 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: Logging to catalina logger
Hi Peter, I'm rapidly coming to the conclusion that Tomcat is the Perl of the web application development environments. For those who aren't familiar with Larry Wall's quote on doing things in Perl, it's There's always more than one way to do it. Starting at the top: 1. Use the log() method 2. Use System.out/err and set Context.swallowOutput to true 3. Use the Standard Error Logger and Standard Output Logger I suspect you probably want to use 2 or 3. All this information is available in the wonderful documentation provided by the Tomcat developers when you download the Tomcat installation. It's just a matter of reading them . The log() method is defined in the ServletContext class in the J2EE documentation. #2 is documented in the Reference/Context section of the Tomcat documentation. #3 is documented in the Reference/Logger section of the Tomcat documentation. Cheers, -- jon Peter Lee wrote: How do I produce log output to the catalina loggerwhen my program wants to print out some exceptions or messages? Any documents on this? Thanks -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Jon Eaves [EMAIL PROTECTED] http://www.eaves.org/jon/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logging to catalina logger
On Sun, 1 Dec 2002, Peter Lee wrote: Date: Sun, 01 Dec 2002 17:05:59 -0800 From: Peter Lee [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Logging to catalina logger How do I produce log output to the catalina loggerwhen my program wants to print out some exceptions or messages? Any documents on this? Any output your servlet generates via ServletContext.log() goes here. Thanks -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]