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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:02:35+00:00 2026-06-10T20:02:35+00:00

In my existing application org.apache.log4j API’s have been used in java code. Requirement :

  • 0

In my existing application “org.apache.log4j” API’s have been used in java code.

Requirement :

I have to log some statement(say xyz) in log file in any case and should not dependent of log levels.For example : if my log level is error then also xyz should print, if my log level is debug then also xyz should print.

I cannot make log statement of xyz is debug because if i do this, other log statements apart from xyz will also start printing.

For this, I believe, I have to add some custom log level.Please help how to do it and how to set its level ordering so that in any case it should print.

Thanks in advance.
Best Regards

  • 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-10T20:02:37+00:00Added an answer on June 10, 2026 at 8:02 pm

    What you could do is create a different Logger for those statements (you are not restricted to use classes names when defining a logger)

    // Standard logger
    private static Logger log = Logger.getLogger(MyClass.class)
    
    // XYZ logger
    private static Logger logXYZ = Logger.getLogger("logs.xyz");
    

    You can access the same logger from several class, you just have to pass the same label.

    Then, in the configuration file, you can define a different log level for that category, and even output these logs in a different appender (different file, processing, etc.)

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

Sidebar

Related Questions

I have been tasked to replace the hardware an existing Apache/Tomcat/MySQL application is running.
I have an existing application which does all of its logging against log4j. We
I have an existing application (with MySQL DB). I just got a new requirement
I have an existing application that imports data from a web site api into
A new requirement has come into an existing application. Current, we have an organization
We used aspectJ to get some metric on an existing application. When building and
We have an existing application that relies heavily on stored procedures and untyped DataSets.
Background: I have a Spring 2.5/Java/Tomcat application. There is the following bean, which is
I have an application where i have a screen with some edit text fields
I'm trying to do a django-south migration to an existing application to add django-audit-log

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.