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

  • Home
  • SEARCH
  • 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 8514751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:57:20+00:00 2026-06-11T04:57:20+00:00

After searching for the answers to my questions Implementing logging in a Java application

  • 0

After searching for the answers to my questions Implementing logging in a Java application and Using the java.util.logging package in a Swing application about the java.util.logging package, I have tracked down the problem and want to share my solution here. I am posting this as a new question to (hopefully) give a concise statement of the actual problem (which is not entirely clear in my previous questions because I was asking the wrong question) as well as to give a (hopefully) clear answer.

The following code illustrates the problem:

package jdbcloggingsscce;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class JDBCLoggingSSCCE {
    public static void main(String[] args) throws IOException, SQLException {
        JDBCLoggingSSCCE.initLogger();
        Logger logger = Logger.getLogger(JDBCLoggingSSCCE.class.getName());
        logger.log(Level.INFO, "Starting JDBCLoggingSSCCE");

        Connection conn = DriverManager.getConnection(DB_URL);
        logger.log(Level.INFO, "JDBC Connection created");
    }

    private static void initLogger() throws IOException {
        Handler handler = new FileHandler(JDBCLoggingSSCCE.LOG_FILE_NAME);
        handler.setFormatter(new SimpleFormatter());

        Logger logger = Logger.getLogger("");
        logger.setLevel(Level.ALL);
        logger.addHandler(handler);
    }
    private static final String LOG_FILE_NAME = "jdbcloggingsscce.log";
    private static final String DB_URL = "jdbc:hsqldb:file:db/jdbcloggingsscce.db";
}

This example uses the JDBC drivers for the HyperSQL Database Engine (HSQLDB). The problem is that the first logging message (“Starting JDBCLoggingSSCCE”) is logged, but the second message (“JDBC Connection created”) is not.

  • 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-11T04:57:22+00:00Added an answer on June 11, 2026 at 4:57 am

    The solution is to set a system property called “hsqldb.reconfig_logging” to false. One way to set this property is to add the following line of code to the end of the initLogger() method:

    System.setProperty("hsqldb.reconfig_logging", "false");
    

    I believe that placement isn’t entirely crucial as long as it is before the call to DriverManager.getConnection(DB_URL). Setting this “hsqldb.reconfig_logging” property tells the HSQLDB JDBC driver to not reconfigure Loggers from the java.util.logging package. The result is logging in the rest of the application continues as desired. Of course, HSQLDB also includes logging messages itself, but dealing with those is for another Q&A.

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

Sidebar

Related Questions

After searching the other questions none have answered the specific issue I have. We
After searching a lot i did not get any answers and finally i had
After searching I dd not find anything about glassfish3.1 and CORS Is it possible
After searching in the Net for about 4 hours I still don't understand Async
After searching through some existing libraries for JSON, I have finally ended up with
After searching a long time for a performance bug, I read about denormal floating
UPDATE: After searching a bit I don't seem to be alone about this problem:
After quite a few hours of searching for answers to this to no avail,
After searching a lot, reading every tutorials I've found and asking some questions here,
After searching online this is a question I have been unable to find an

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.