dev@glassfish.java.net

Re: Logger info

From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: Wed, 17 Sep 2008 16:00:29 -0700

>> Also, I think the "names" of the loggers are of essence here. From
>> that point
>> of view, Logger.getLogger(String name) is appropriate if you know the
>> name
>> of the logger you use and don't want to have a dependency on LogDomains.
>> Is that a correct?
> Let me think about this. Are you expecting the parent's resource bundle
> to be used since you are not providing one?

I am providing one LogStrings.properties in the right path. All I am saying
is whether for instance,

Logger.getLogger("javax.enterprise.system.tools.admin") will return me the
logger that gets the associated resource bundle or

do I have to use LogDomains.getLogger(ADMIN_LOGGER)?

  Are you expecting that none
> will be used?

>> Carla -- can you please modify the default logging.properties (yes,
>> logging.properties, not LogStrings.properties) with the names of some
>> of our
>> loggers (e.g. WEB, ADMIN, ROOT etc.) so that people can get used to
>> their names?
>> This will also help users know which subsystem in v3 Prelude uses
>> which logger.
>> This is all the more important since we have no tool support in Prelude.
>
> I have added a bunch already. I will add the rest. Look at the end of
> the file and they are all commented out for now.
Where did you add it? I must be missing something. Attached is my
logging.properties from the latest web.zip. (Also, can you tell me where
you have checked in the logging.properties?

Thanks.



############################################################
# Default Logging Configuration File
#
# You can use a different file by specifying a filename
# with the java.util.logging.config.file system property.
# For example java -Djava.util.logging.config.file=myfile
############################################################

############################################################
# Global properties
############################################################

# "handlers" specifies a comma separated list of log Handler
# classes. These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
# By default we only configure a ConsoleHandler, which will only
# show messages at the INFO and above levels.

# In glassfish, it is not a good idea to add handlers this way
# as it requires the handler to be on the system classpath.
# A better approach is to define an HK2 component wich implements
# the Hanlder contract :
#
# @Service(name="console")
# @ContractProvided(Handler.class)
# public class MyConsoleHandler implements Handler {
# // implementation of Handler interface
# }

handlers= java.util.logging.ConsoleHandler

# To also add the FileHandler, use the following line instead.
#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overriden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= FINE

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

# this is the default hanlder for Glassfish, it writes to a log file
# The handler is not registered through the handlers property above
# because the implementation is not on the system class path.
# GlassFish will register this handler automtically as it is
# and HK2 component like described above.
# rotates the file based on time or size.
com.sun.enterprise.server.logging.FileandSyslogHandler.file=logs/server.log
# rotation time in minutes (takes precedence on size if defined),
# 0 for no rotation based on time
com.sun.enterprise.server.logging.FileandSyslogHandler.rotationTimelimitInMinutes=0
# rotation limit in bytes, 0 means no rotation, 500000 is the minimum
com.sun.enterprise.server.logging.FileandSyslogHandler.rotationLimitInBytes=0
# formatter used to format the log records in the server log file
com.sun.enterprise.server.logging.FileandSyslogHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter


# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = com.sun.enterprise.server.logging.UniformLogFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
com.xyz.foo.level = SEVERE