Today, the written code is tested on Ubuntu and a few problems are found.
1: Every time svn update source, after the tomcat redeployment log files will disappear ~ ~
View Source Discovery:
Java.util.logging.FileHandler private void Configure () {Logmanager manager = Logmanager.getlogmanager ();
String cname = GetClass (). GetName ();
Pattern = Manager.getstringproperty (CNAME + ". Pattern", "%h/java%u.log");
Limit = Manager.getintproperty (CNAME + ". Limit", 0);
if (Limit < 0) {limit = 0;
Count = Manager.getintproperty (CNAME + ". Count", 1);
if (count <= 0) {count = 1;
} append = Manager.getbooleanproperty (CNAME + ". Append", false);
Setlevel (Manager.getlevelproperty (CNAME + ". Level", Level.all));
SetFilter (Manager.getfilterproperty (CNAME + ". Filter", null));
Setformatter (Manager.getformatterproperty (CNAME + ". Formatter", New Xmlformatter ());
try {setencoding (Manager.getstringproperty (CNAME + ". Encoding", null));
The catch (Exception ex) {try {setencoding (null);
The catch (Exception ex2) {//doing a setencoding with null should always.
Assert false; }
}
}
Where this line indicates that the log data is not appended by default
Append = Manager.getbooleanproperty (CNAME + ". Append", false);
So you need to configure it under Logging.properties.
To solve this problem
2: Note that there is such a sentence in the Logger.properties file, which means that basically you cannot configure the custom handler through the configuration file.
These handlers would be installed during VM startup.
# These classes must are on the system classpath.
# "Handlers" specifies a comma separated list of log Handler
# classes. These handlers would be installed during VM startup.
# These classes must are on the system classpath.
# By default We only configure a consolehandler, which'll only
# Show messages at the INFO and above levels.
handlers= Java.util.logging.ConsoleHandler, Java.util.logging.FileHandler