Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8830785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:10:20+00:00 2026-06-14T08:10:20+00:00

This is a bit weird, but I’m new to the logging package and its

  • 0

This is a bit weird, but I’m new to the logging package and its use of properties. All the questions I can find by googling are “how to make logging open multiple files?” but my question today is how to make it stop doing multiple files simultaneously. Here we go…

First things first: this project is restricted to using java.util.logging, no I can’t switch to log4j or any other third-party package, yes I know they’re supposed to be more awesome. 🙂

So when this applet starts up, it runs this bit of code:

import java.util.logging.Logger;
import java.util.logging.LogManager;

// in startup routine:
LogManager.getLogManager().readConfiguration(
  this.getClass().getResourceAsStream("/logging.properties"));

to pull out the properties file out of a JAR and apply them, which works. The readConfiguration() is supposed to reset all existing settings from the VM startup. The rest of the project has lines like

private final static Logger LOGGER = Logger.getLogger(NameOfClass.class.getName());

which I believe is pretty standard. All our classes are in the same package (call it TheProject for example), and the funky logging names/property hierarchy follows the same convention because that’s just how java.util.logging likes to roll.

The logging.properties file started off as a copy of the one that ships with the Java 6 SE JRE and then got modified. Now it looks like this:

handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler

# Default global logging level. 
.level=INFO

# 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. 
java.level = INFO
javax.swing.level = INFO
sun.awt.level = INFO
theproject.level = ALL

# Handlers 
# -----------------------------------------
theproject.handlers=java.util.logging.FileHandler

# Override of global logging level 
java.util.logging.FileHandler.level=ALL

# Naming style for the output file: 
java.util.logging.FileHandler.pattern=/path/to/logfiles/TheProject%u.%g.log

All that “works”, in that the log messages show up in the Java console and also appear in the disk files. Here’s the weird part: as soon as the applet runs, two files are opened at the same time, both TheProject0.0.log and TheProject1.0.log. When log messages are fired off, they show up in both files simultaneously. Both files are an exact copy of each other at all times, including when the max size is reached and are (both!) rotated.

There is only one JRE VM running at a time, I checked.

At any given time, either both files are opened, or both are closed, I checked. It’s not like one is open for longer or shorter time than the other.

The %u token that’s different between the two filenames is documented as “a unique number to resolve conflicts” in case the logfile is already open by another process, but I think that’s not the case here, since both logs are getting identical data and nothing else opens the file. (evidence: Windows won’t let me delete either file while the VM is running, but it will once the VM finally exits.)

Am I doing something stupid in the properties file, or misunderstanding how to load the properties correctly, or…?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:10:21+00:00Added an answer on June 14, 2026 at 8:10 am

    @Joop nailed it (in a comment, which can’t be marked as the answer). It turns out that setting a handler is an additive process, it does not simply overwrite the previous settings. That seems really unintuitive to me, but that’s java.util.logging for ya… Leaving all the other properties in place, but removing the handler assignment, was the way to go.

    I’m also using the reset() call suggested by @jschoen because that just seems to be a smart thing to do!

    Many thanks to all of you. I’m not sure how to mark this all as “closed”… time to fiddle with the site some.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might seem a bit weird, but since I am new in RoR and
This is a bit of a weird request but I am trying to set
This is a bit of a weird desire but I am making a matching
Okay this may sound a bit weird but it is what I have to
This is a bit of a weird question but, with the functionalities of C++,
Bit of a weird title but here what i got. I have found this
I'm not sure if this behaviour is intended, but it seems a bit weird
I have some HTML like this (yep, it's a bit weird, but it's an
This is a bit weird, but I have no idea where the problem is.
This bit of code comes with new classes that are subclasses of UITableViewController... -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.