log4j custom level

I've seen several references to making a custom level in log4j, but I can't seem to find any examples.

Does anyone know where I can find one?

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.

There are also references in the short manual saying that this is not a good idea ;-)

Why do you want to do it?
k41d3nAuthor Commented:
I'm writing an automated test program and I wanted to make custom levels for PASS and FAIL, then append the FAILS to a separate log file.

I could do this with ERROR and INFO, I just like the look of PASS and FAIL when the program is running. When someone not familiar with log4j uses the app, ERROR and INFO isn't the most user friendly, PASS, FAIL is pretty cut and dry.

Any ideas? Or am I just too picky? ;)
One idea that springs to mind is (especially since you single this out for special treatment) is to make a special Test class. It can then use a separate Appender easily

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
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

k41d3nAuthor Commented:
A separate Test class as in, a Logging Test Class?
Yes, anything really, so that you can do


You can also use filters i think, but i don't have much experience of that
Difficult to find an example of a filter. This may be helpful:

(That filter would go inside the <appender> btw. You could match on PASS/FAIL)
k41d3nAuthor Commented:
Bingo. Took me awhile. but I got it :)

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

From novice to tech pro — start learning today.