You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Усманов Азат Анварович <us...@ieml.ru> on 2019/12/06 09:24:06 UTC

Add date and app name to catalina,out

Hello  everyone! Is it possible to add app name and error date to catalina.out in case of an exception ?(both in console and in catalina.out file)
I amd using follow logginng properties in tomcat

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration ALL for Handlers.
############################################################

1catalina.org.apache.juli.FileHandler.level = ALL
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
1catalina.org.apache.juli.FileHandler.formatter = java.util.logging.SimpleFormatter
1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8
java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] [%4$-7s] %5$s %n


2localhost.org.apache.juli.FileHandler.level = ALL
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8



java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.encoding = UTF-8

currently I have the following  printed to  console on error in case app produces an error

[2019-12-06 11:24:34] [INFO   ] Loaded APR based Apache Tomcat Native library 1.2.19 using APR version 1.6.5.
[2019-12-06 11:24:34] [INFO   ] APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
[2019-12-06 11:24:34] [INFO   ] OpenSSL successfully initialized (OpenSSL 1.1.1a  20 Nov 2018)
[2019-12-06 11:24:34] [INFO   ] Initializing ProtocolHandler ["http-apr-8080"]
[2019-12-06 11:24:34] [INFO   ] Initialization processed in 363 ms
[2019-12-06 11:24:34] [INFO   ] Starting service Catalina
[2019-12-06 11:24:34] [INFO   ] Starting Servlet Engine: Apache Tomcat/7.0.92
[2019-12-06 11:24:41] [INFO   ] Starting ProtocolHandler ["http-apr-8080"]
[2019-12-06 11:24:41] [INFO   ] Server startup in 6348 ms

java.lang.NumberFormatException: For input string: "ff"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.valueOf(Integer.java:582)
at com.ieml.util.ServletUtilities.getIntParameter(ServletUtilities.java:224)
at com.ieml.servlets.contract.ContractsServlet.beforePrintPage(ContractsServlet.java:356)
at com.ieml.basedata.BaseDataServlet2.doPost(BaseDataServlet2.java:146)
at com.ieml.basedata.BaseDataServlet2.doGet(BaseDataServlet2.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
i want t it to be
[2019-12-06 11:24:42][Education] java.lang.NumberFormatException: For input string: "ff"
where  Education is app name
is that possible?