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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:56:10+00:00 2026-05-23T12:56:10+00:00

I have a class with several methods. I would like each method to output

  • 0

I have a class with several methods. I would like each method to output to a different log file. With a logback.xml file like this, it logs ALL logging calls from the class.

<logger name="com.mincom.ellipse.conversion.BatchConverter" level="INFO">
   <appender-ref ref="FILE" />
</logger>

How do I get per method logging calls. I’m sure it’s very simple, but I cannot seem to see the answer in the doco.

  • 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-23T12:56:11+00:00Added an answer on May 23, 2026 at 12:56 pm

    Haven’t used logback, but in log4j and others you can setup loggers with any name you like. Using the classes package and name is just a convention. So I’d setup Multiple loggers in your class, something like this:

    Logger logA = LogFactory.getLogger("LogA");
    Logger logB = LogFactory.getLogger("LogB");
    
    public void methodA() {
        logA.debug(...);
    }
    public void methodB() {
        logB.debug(...);
    }
    

    And then in your logback setup …

    <logger name="LogA" level="INFO">
       <appender-ref ref="FILE-A" />
    </logger>
    
    <logger name="LogB" level="INFO">
       <appender-ref ref="FILE-B" />
    </logger>
    

    Should work. Probably needs some tweaking 🙂

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

Sidebar

Related Questions

I have a class that is called regularly by several objects. I would like
I have 1 unit test method that needs several parameters. I would like to
I have an application that uses several different Java classes and would like to
I have a class that currently has several methods that take integer parameters. These
I have an interface, IMessage and a class which have several methods for creating
I have a class library containing several structures each consisting of several value and
I have a class Person which can have several Homes, each one with one
I'd like to be able to have a method in a C# base class,
I have a custom class Manager in Xcode. This class spawns several instances of
I currently have a Order and image model which look like this: class Order

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.