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_yyyy";
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]>