aspose file tools*
The moose likes Java in General and the fly likes java.util.logging.FileHandler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.util.logging.FileHandler" Watch "java.util.logging.FileHandler" New topic
Author

java.util.logging.FileHandler

Karsten Brondum
Greenhorn

Joined: Jan 04, 2010
Posts: 6
I'm in the process of setting up logging using java.util.logging

when running java -Djava.util.logging.config.file=C:/Projekter/Sam02/Sam02/StulaLog.properties -cp .......

with StulaLog.properties like shown below the console logger formats the log as strings. The file formatter formats the log file as XML. If i change

java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

to java.util.logging.XMLFormatter, the console logger is changed to xml. No matter what i do in the filehandler formatter, the log file gets created in xml format.

please advise as to what i'm missing

Thanks in Advance
Karsten.



# Properties file which configures the operation of the JDK
# logging facility.

# The system will look for this config file, first using
# a System property specified at startup:
#
# >java -Djava.util.logging.config.file=myLoggingConfigFilePath
#
# If this property is not specified, then the config file is
# retrieved from its default location at:
#
# JDK_HOME/jre/lib/logging.properties

# Global logging properties.
# ------------------------------------------
# The set of handlers to be loaded upon startup.
# Comma-separated list of class names.
# (? LogManager docs say no comma here, but JDK example has comma.)
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler

# Default global logging level.
# Loggers and Handlers may override this level
.level=FINEST

# Loggers
# ------------------------------------------
# Loggers are usually attached to packages.
# Here, the level for each package is specified.
# The global level is used by default, so levels
# specified here simply act as an override.
myapp.ui.level=ALL
myapp.business.level=CONFIG
myapp.data.level=SEVERE

# Handlers
# -----------------------------------------

# --- ConsoleHandler ---
# Override of global logging level
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

# --- FileHandler ---
# Override of global logging level
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern=%h/javasnafu%u.log

# Naming style for the output file:
# (The output file is placed in the directory
# defined by the "user.home" System property.)

# Limiting size of output file in bytes:
java.util.logging.FileHandler.limit=50000

# Number of output files to cycle through, by appending an
# integer to the base file name:
java.util.logging.FileHandler.count=1

Andreas Koenig
Greenhorn

Joined: Jan 10, 2012
Posts: 7

Works for me. What java version are you using?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.util.logging.FileHandler
 
Similar Threads
RAD6/WAS6 Logging config..
why the logging is not working ?
java.util.Logging configuration...
java.util.Logging configuration
NX: which logging file?