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 7547665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:30:38+00:00 2026-05-30T09:30:38+00:00

Using java.util.logging.Logger to output some log to the console just like this: public static

  • 0

Using java.util.logging.Logger to output some log to the console just like this:

public static void main(String[] args) {
    Logger logger = Logger.getLogger("test");
    logger.info("Hello Wolrd!");
}

The output is:

FEB 16, 2012 10:17:43 AM com.abc.HelloWorld main
INFO: Hello World.

This seems to be OK, however…

We are using java.util.logging.Logger in all our Ant tasks (an internal standard) and we have a large ant project. The console output of a full cycle can be larger than 300KB, in which our own logger output taks at least 50.

Now I don’t want to see the information about time, class name and method of Level.INFO outputs. Also the information line makes it hard to focus on the custom messages.

So is there any way to remove the first line (information of timestamp, class and method) from each output (or just from each Level.INFO output)?

  • 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-05-30T09:30:39+00:00Added an answer on May 30, 2026 at 9:30 am

    See How do I get java logging output to appear on a single line?. However, the only difference is removing the first line, instead of putting it on one line.

    To only do this for INFO levels, extend the formatter you want to conditionally modify (e.g. SimpleFormatter), and override the format method. You could do something like this:

    public String format(LogRecord record){
      if(record.getLevel() == Level.INFO){
        return record.getMessage() + "\r\n";
      }else{
        return super.format(record);
      }
    }
    

    If you’re doing this only for INFO, you probably don’t need the “INFO: ” prefix – but you could add it back on if you’d like.

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

Sidebar

Related Questions

I want simply to log on the console using java.util.Logging: Logger log = Logger.getLogger(my.logger);
I would like to do this using java.util.logging if possible, any ideas? thanks.
I am using java.util.logging.Logger But with storing messages in a log file, it also
I'm using Tomcat 6, and this is my logging.properties: handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler .level=FINE
Using the standard java logging API (import java.util.logging.Logger), after the construction: Logger l =
I'm using this mapper created by Ikai Lan: package com.ikai.mapperdemo.mappers; import java.util.Date; import java.util.logging.Logger;
I am using the java.util.logging API and atatching several FileHandlers to a named logger
I'm using a java.util.concurrent.ExecutorService that I obtained by calling Executors.newSingleThreadExecutor() . This ExecutorService can
In my application I have written my own Logging utility using Java.Util.Logging import java.io.IOException;
Using the logging classes in java.util.logging, is it possible to set up two different

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.