|
Replies:
5
-
Last Post:
Sep 4, 2008 6:49 AM
by: cesarico
|
|
|
|
|
|
|
glassfish and logging
Posted:
Aug 25, 2008 9:04 AM
|
|
|
Does somebody know how redirect logging output in different files?
I want have different files for different kind of errors; I mean - one file only for INFO messages - one file only for WARNING messanges ... etc
Can somebody help me?!
thx
|
|
|
|
|
|
|
Re: glassfish and logging
Posted:
Aug 26, 2008 7:28 AM
in response to: kkiara
|
|
|
No, this is not available, just by changing configuration. In theory, you can write your own scanner to do this as a post-processing step.
-Kedar
|
|
|
|
|
|
|
|
Re: glassfish and logging
Posted:
Aug 26, 2008 12:49 PM
in response to: km
|
|
|
glassfish@javadesktop.org schrieb: > No, this is not available, just by changing configuration. In theory, > you can write your own scanner to do this as a post-processing step.
Having things like this available through the web administration console simply to be set up and enabled at runtime however would greatly help, same as I am still then and now dreaming to, in "Logging" setup, not just be capable of setting log levels for my custom packages but also to, once in there, define to which log file output eventually should be dumped... In tomcat one mostly uses commons-logging or log4j for these things, basically making it application-dependent, which I also don't think is a good idea. Logging aspects as a whole (including levels _and_ target loggers) should be configurable in the application server transparently at application runtime... Any chance of having a feature like this in glassfish anytime soon?
Cheers & best regards, Kristian
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|
|
|
|
Re: glassfish and logging
Posted:
Sep 4, 2008 2:40 AM
in response to: kawazu
|
|
|
Hello
I am looking for something similar: I'd like to set up different log files for different web applications within the server. I think this should not be a big deal: I can do it within Tomcat, so I see no reason why I could not use Tocat's logger system.
The point is that I tried to change the Log Handler in the Glassfish dashboard and I get an error message. I have not tried much harder, because I thought that somebody could have faced the same problem and could give me a hint. I am going in the right direction? should I be able to use Tomcat's logger within Glassfish?
cheers
|
|
|
|
|
|
|
|
Re: glassfish and logging
Posted:
Sep 4, 2008 2:40 AM
in response to: cesarico
|
|
|
Hi there;
glassfish@javadesktop.org schrieb: [...] > I am looking for something similar: I'd like to set up different log > files for different web applications within the server. I think this > should not be a big deal: I can do it within Tomcat, so I see no reason > why I could not use Tocat's logger system.
You are likely to use log4j or something like this in tomcat, aren't you? This way, configuring per-application log files along with an application itself seems way more straightforward than it is while using the JDK logging glassfish is using. From that point of view, you are of course free to use log4j or something similar for your applications to do the logging. But:
> The point is that I tried to change the Log Handler in the Glassfish > dashboard and I get an error message.
What exactly did you try? Increase / change log levels? Adding custom loggers?
Point being: Talking about the glassfish administration console, you get a lot more feature than tomcat possibly offers (online log browser, the ability to set log levels for packages and classes without messing with configuration files, log rotation, syslog integration and all that stuff) so while using glassfish logging, you can leave most of the logging configuration out of your application.
Drawback of this, of course: You have to go with the way glassfish does its logging, namely use the JDK logger (or some facade on top of it, like slf4j or commons-logging) rather than log4j. While using plain log4j, trying to configure this using the web ui is likely to fail because basically the UI doesn't know about your application-specific log4j configurations. So far, I consider this the price to pay for using the "additional comfort" provided by glassfish logging (I spent quite some time searching, in example, for a tomcat based online administration console to allow log file viewing...). Asides that, you might want to have a look at [1] which seems a workaround to use glassfish with log4j, but so far I never really tried. 
Cheers & good luck, Kristian
[1]http://weblogs.java.net/blog/schaefa/archive/2007/08/to_the_hell_wit_1.html
-- Kristian Rink cell : +49 176 2447 2771 business: http://www.planconnect.de personal: http://pictorial.zimmer428.net "we command the system. calling all recievers. we are noisy people for a better living". (covenant - "monochrome")
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|
|
|
|
Re: glassfish and logging
Posted:
Sep 4, 2008 6:49 AM
in response to: Kristian Rink
|
|
|
Hello
Thank you for your reply.
I am not using Log4J, I allways try to stick to the java.util.logging API. Within Tomcat, I create a logging.properties file like the one I am pasting below; I place it in the root package of the web application's source code, and as far as I remember I need no extra configuration.
What I was trying to do is to figure out the concrete class that is used within Tomcat, and put it in the "Log Handler" parameter in the Glassfish admin interface ( Configurations > server-config > Logger settings > General ).
I tried with the class "java.util.logging.LogManager" and I get this error:
java.lang.IllegalAccessException: Class com.sun.enterprise.server.logging.ServerLogManager$3 can not access a member of class java.util.logging.LogManager with modifiers "protected"
I am going to try again with some other configuration, just to see if I can use a different Log Manager.
About the features that you mention on the Glassfish logging system, I'd say they are useful for a server with few users, but once I have several applications producing logs in one server I think that separating them is a must.
# # JULI-based logging configuration # # see http://tomcat.apache.org/tomcat-5.5-doc/logging.html # handlers = 1myOrg.pack1.org.apache.juli.FileHandler, 2myOrg.pack2.org.apache.juli.FileHandler
# root handlers: .handlers = 1myOrg.pack1.org.apache.juli.FileHandler
1myOrg.pack1.org.apache.juli.FileHandler.level = FINE 1myOrg.pack1.org.apache.juli.FileHandler.directory = /var/dev/logs/ 1myOrg.pack1.org.apache.juli.FileHandler.prefix = myOrg.pack1
2myOrg.pack2.org.apache.juli.FileHandler.level = FINE 2myOrg.pack2.org.apache.juli.FileHandler.directory = /var/dev/logs/ 2myOrg.pack2.org.apache.juli.FileHandler.prefix = myOrg.pack2
myOrg.package1.level = FINE myOrg.package1.handlers = 1myOrg.pack1.org.apache.juli.FileHandler
myOrg.package1.someSubPackage.level = INFO myOrg.package1.someSubPackage.handlers = 2myOrg.pack2.org.apache.juli.FileHandler
myOrg.package2.level = FINE myOrg.package2.handlers = 2myOrg.pack2.org.apache.juli.FileHandler
|
|
|
|
|