Multiple LOGGERS in 1 java class

Hi,
I have a class that based on a parameter branches out to some piece of logic.  I need to have INFO level logging for any path of execution.  
I have defined a logger
private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class);

I've also defined a certain amount of appenders relevant to each of the paths of executions which log to specific unique log files.
if i use LOGGER.info("blah"), it will log all the info to ALL the files.  

My question is, Lets say i have a function with a switch statement, how can i create many loggers so that i can say something like this:
LOGGERX1.info("x1 process"); // this will log info level to a file called x1.log
LOGGERX2.info("x2 process"); // this will log info level to a file called x2.log

from the same function so that even though all the loggers are INFO level, only certain logger receives the notification to log there rather then all have the same info...

Please help.
Thanks
LVL 1
SquadlessAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpearsonCommented:
Just give each logger a unique name, e.g.

private static final Logger LOGGER1 = LoggerFactory.getLogger(MyClass.class + ".1");
private static final Logger LOGGER2 = LoggerFactory.getLogger(MyClass.class + ".2");

and log away.

You can set appenders differently for each, log to one at INFO and the other at DEBUG or log to both at INFO.  Whatever you like.

Doug
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.