Discussion:
Tomcat 5 : DEBUG level
Francesco Pellegrini
2004-04-13 16:01:41 UTC
Permalink
Hi all,

I'm looking for an help to customize a LOG level for my server.
I have some JSP and SERVLET that uses :

System.out.println("message...");

in server.xml I set :

<Logger className="org.apache.catalina.logger.FileLogger"
verbosity="4" directory="logs" prefix="localhost_log."
suffix=".txt"
timestamp="true"/>


Now, Instead of save the message on stdout.log I would like to store all
message on localhost_log.YYYY-MM-DD.txt, beacause the stdout.log it's
become too large.

How can i solve this issue?

Thanks

Franz.
Shapira, Yoav
2004-04-15 13:04:29 UTC
Permalink
Hi,
getServletContext().log("message...");

RTFM.

Yoav Shapira
Millennium Research Informatics
-----Original Message-----
Sent: Tuesday, April 13, 2004 12:02 PM
To: Tomcat Users List
Subject: Tomcat 5 : DEBUG level
Hi all,
I'm looking for an help to customize a LOG level for my server.
System.out.println("message...");
<Logger className="org.apache.catalina.logger.FileLogger"
verbosity="4" directory="logs" prefix="localhost_log."
suffix=".txt"
timestamp="true"/>
Now, Instead of save the message on stdout.log I would like to store
all
message on localhost_log.YYYY-MM-DD.txt, beacause the stdout.log it's
become too large.
How can i solve this issue?
Thanks
Franz.
---------------------------------------------------------------------
This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
Francesco Pellegrini
2004-04-15 13:28:03 UTC
Permalink
Hi,

getServletContext().log("message...");

When I was in Servlet class or in JSP pages I can use it, but How can I log
message if I'm in Model or Controller layer ( my application is tie-tier),
for examples in MyDBConnection.class and I don't have a ServletContext?

Thanks,

Francesco.

-----Messaggio originale-----
Da: Shapira, Yoav [mailto:***@mpi.com]
Inviato: giovedi 15 aprile 2004 15.04
A: Tomcat Users List
Oggetto: RE: Tomcat 5 : DEBUG level



Hi,
getServletContext().log("message...");

RTFM.

Yoav Shapira
Millennium Research Informatics
-----Original Message-----
Sent: Tuesday, April 13, 2004 12:02 PM
To: Tomcat Users List
Subject: Tomcat 5 : DEBUG level
Hi all,
I'm looking for an help to customize a LOG level for my server.
System.out.println("message...");
<Logger className="org.apache.catalina.logger.FileLogger"
verbosity="4" directory="logs" prefix="localhost_log."
suffix=".txt"
timestamp="true"/>
Now, Instead of save the message on stdout.log I would like to store
all
message on localhost_log.YYYY-MM-DD.txt, beacause the stdout.log it's
become too large.
How can i solve this issue?
Thanks
Franz.
---------------------------------------------------------------------
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else. If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-***@jakarta.apache.org
For additional commands, e-mail: tomcat-user-***@jakarta.apache.org
R***@VerizonWireless.com
2004-04-15 13:33:42 UTC
Permalink
I think you need to setup a logger, if using java1.4
then just use built in java.util.logging.Logger, otherwise
maybe log4j, prob best to create a file logger and log ALL
webapp spcefic messages to it

here is mine if you need something to start, its a singleton
so you'd typically invoke with

cdmanager.CdManagerLogger.getInstance().logp(
Level.FINE,
this.getClass().getName(),
"yourMethodName",
"your output message");

===================================
package cdmanager;

import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.logging.FileHandler;


public class CdManagerLogger
{
protected static java.util.logging.Logger logger = null;

private CdManagerLogger()
{
if(logger==null)
{
// Initalize the instance of the class
logger = java.util.logging.Logger.getLogger("");
try
{
FileHandler fh = new
FileHandler("D:\\JBuilder9\\myprojects\\cdmanager\\logs\\cdmanager.log");
fh.setFormatter(new java.util.logging.SimpleFormatter());
// Send logger output to our FileHandler.
logger.addHandler(fh);
logger.setLevel(java.util.logging.Level.ALL);
}
catch(Exception e) { e.printStackTrace(); }
}
}
static public java.util.logging.Logger getInstance()
{
if(logger!=null)
return logger;
else
{
new CdManagerLogger();
return logger;
}
}
}


-----Original Message-----
From: Francesco Pellegrini [mailto:***@telematicaitalia.it]
Sent: Thursday, April 15, 2004 9:28 AM
To: Tomcat Users List
Subject: R: Tomcat 5 : DEBUG level


Hi,

getServletContext().log("message...");

When I was in Servlet class or in JSP pages I can use it, but How can I log
message if I'm in Model or Controller layer ( my application is tie-tier),
for examples in MyDBConnection.class and I don't have a ServletContext?

Thanks,

Francesco.

-----Messaggio originale-----
Da: Shapira, Yoav [mailto:***@mpi.com]
Inviato: giovedi 15 aprile 2004 15.04
A: Tomcat Users List
Oggetto: RE: Tomcat 5 : DEBUG level



Hi,
getServletContext().log("message...");

RTFM.

Yoav Shapira
Millennium Research Informatics
-----Original Message-----
Sent: Tuesday, April 13, 2004 12:02 PM
To: Tomcat Users List
Subject: Tomcat 5 : DEBUG level
Hi all,
I'm looking for an help to customize a LOG level for my server.
System.out.println("message...");
<Logger className="org.apache.catalina.logger.FileLogger"
verbosity="4" directory="logs" prefix="localhost_log."
suffix=".txt"
timestamp="true"/>
Now, Instead of save the message on stdout.log I would like to store
all
message on localhost_log.YYYY-MM-DD.txt, beacause the stdout.log it's
become too large.
How can i solve this issue?
Thanks
Franz.
---------------------------------------------------------------------
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else. If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-***@jakarta.apache.org
For additional commands, e-mail: tomcat-user-***@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-***@jakarta.apache.org
For additional commands, e-mail: tomcat-user-***@jakarta.apache.org
Shapira, Yoav
2004-04-15 13:48:18 UTC
Permalink
Hi,
Post by Shapira, Yoav
getServletContext().log("message...");
When I was in Servlet class or in JSP pages I can use it, but How can
I
Post by Shapira, Yoav
log
message if I'm in Model or Controller layer ( my application is
tie-tier),
Post by Shapira, Yoav
for examples in MyDBConnection.class and I don't have a ServletContext?
You original question asked only about servlets and JSPs. You can pass
the ServletContext around if you'd like, or for a cleaner solution pick
up a logging toolkit like log4j.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
Francesco Pellegrini
2004-04-15 13:53:19 UTC
Permalink
I'll try to use log4j.

Thanks for your kind attention

Francesco.



-----Messaggio originale-----
Da: Shapira, Yoav [mailto:***@mpi.com]
Inviato: giovedi 15 aprile 2004 15.48
A: Tomcat Users List
Oggetto: RE: Tomcat 5 : DEBUG level



Hi,
Post by Shapira, Yoav
getServletContext().log("message...");
When I was in Servlet class or in JSP pages I can use it, but How can
I
Post by Shapira, Yoav
log
message if I'm in Model or Controller layer ( my application is
tie-tier),
Post by Shapira, Yoav
for examples in MyDBConnection.class and I don't have a ServletContext?
You original question asked only about servlets and JSPs. You can pass
the ServletContext around if you'd like, or for a cleaner solution pick
up a logging toolkit like log4j.

Yoav Shapira



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else. If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-***@jakarta.apache.org
For additional commands, e-mail: tomcat-user-***@jakarta.apache.org
Loading...