Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


Karsten Brondum
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/ -cp .......

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


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

# 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/

# 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

# 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.

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

# --- ConsoleHandler ---
# Override of global logging level

# --- FileHandler ---
# Override of global logging level

# 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:

# Number of output files to cycle through, by appending an
# integer to the base file name:

Andreas Koenig
Posts: 7
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works for me. What java version are you using?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!