problem description
currently learning tomcat development, encountered some printing log problems, I would like to add their own print in serverlet, output to some custom file (but not out of the scope of tomcat, do not customize filehandler to C disk, d disk and so on), still like relying on tomcat default log system, output to a file in the tomcat/logs/ directory. I"d like to use it with log.properties.
the environmental background of the problems and what methods you have tried
the method of java.utils.Logger used by log, that I added in the code
private static Logger createLocalLogger()
{
Logger localLogger = Logger.getLogger("bmWebServer");
return localLogger;
}
logger.info(logs)
using this method, I output log directly to tomcat/logs/tomcat9-stdout, which is not what I want.
what result do you expect? What is the error message actually seen?
I can more or less understand the configuration inlog.properties, but I want to know how to use the handler, file path and formatter defined in this in my serverlet code? I can actually type my custom log into catalina.out.
but searching the Internet is full of articles about configuration, or the method of replacing log4j, which is not what I want.
there are great gods here, do you know? Do not hesitate to give advice, thank you!