K
Kenneth Baltrinic
I am new to Java as is the company I work for, but we have just landed
a contract that specifies J2EE as the platform, so here we are.
Please bear with me.
I have been charged with determining our logging architecture and it
looks like what is available in java.util.logging will do well (though
we may use log4j). However, at this point I am just trying to get
anything to work and not having much luck.
We are using JSF on the front end and I have created a very simple JSF
page to test logging. The relevant code is below and I hope will be
self explanatory: This code is not meant to be efficient or anything.
It is just a proof of concept.
public String button1_action() {
// User event code here...
try {
Logger l =
java.util.logging.Logger.getLogger(Page1.class.getName());
l.entering(Page1.class.getName(), "button1_action");
l.info(this.textField1.getValue().toString());
l.exiting(Page1.class.getName(), "button1_action");
java.util.logging.Handler h = l.getHandlers()[0];
h.flush();
}
catch(Exception ex) {
//I have tested this and we aren't catching any errors.
System.err.println(ex);
}
return "";
}
My logger.properties files looks like this:
handlers= java.util.logging.FileHandler
..level= FINEST
java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter =
java.util.logging.SimpleFormatter
I have developed and tested this in Sun Studio Creator 2004Q2 What is
happening is that I am getting three log files in c:/sun/logs
test-0.log, test-1.log and test-2.log. The first two contain output
from various sun components. (sun.rmi.transport for example). The
third log remains empty. (zero length)
I have also deployed the test app to a tomcat 5.0.28 server and get
similar results. The only difference is I get only one two log files
and the second one remains empty.
Any assistance or suggestions as to what direction I should be taking
would be appreciated.
Thanks
--Ken
a contract that specifies J2EE as the platform, so here we are.
Please bear with me.
I have been charged with determining our logging architecture and it
looks like what is available in java.util.logging will do well (though
we may use log4j). However, at this point I am just trying to get
anything to work and not having much luck.
We are using JSF on the front end and I have created a very simple JSF
page to test logging. The relevant code is below and I hope will be
self explanatory: This code is not meant to be efficient or anything.
It is just a proof of concept.
public String button1_action() {
// User event code here...
try {
Logger l =
java.util.logging.Logger.getLogger(Page1.class.getName());
l.entering(Page1.class.getName(), "button1_action");
l.info(this.textField1.getValue().toString());
l.exiting(Page1.class.getName(), "button1_action");
java.util.logging.Handler h = l.getHandlers()[0];
h.flush();
}
catch(Exception ex) {
//I have tested this and we aren't catching any errors.
System.err.println(ex);
}
return "";
}
My logger.properties files looks like this:
handlers= java.util.logging.FileHandler
..level= FINEST
java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter =
java.util.logging.SimpleFormatter
I have developed and tested this in Sun Studio Creator 2004Q2 What is
happening is that I am getting three log files in c:/sun/logs
test-0.log, test-1.log and test-2.log. The first two contain output
from various sun components. (sun.rmi.transport for example). The
third log remains empty. (zero length)
I have also deployed the test app to a tomcat 5.0.28 server and get
similar results. The only difference is I get only one two log files
and the second one remains empty.
Any assistance or suggestions as to what direction I should be taking
would be appreciated.
Thanks
--Ken