Error getting output to stdout log4j spring application

In my spring application i have configured log4j . Normally all the logs are going into the log file.
But when say there is some startup error while starting the application like :
java -DFLOCK_APPS_CONFIG=dev -jar target/snippet.jar &
Logs do get pushed to log files but also the error only gets output to the console. I want to get rid of this and why its happening as i have configured log4j.
Error :
Exception in thread "main" Address already in use
	at Method)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(
	at org.eclipse.jetty.server.ServerConnector.doStart(
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
	at org.eclipse.jetty.server.Server.doStart(
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
	at org.directi.code.AppStart.start(
	at org.directi.code.AppStart.main(

[2]+  Exit 1                  java -DFLOCK_APPS_CONFIG=dev -jar target/snippet.jar

Open in new window

This happened when i tried to run the application twice on the same port
Rohit BajajAsked:
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.

This happened when i tried to run the application twice on the same port
That's not surprising you i hope? ;)

Unless you have caught and logged all exceptions in AppStart.main, you are going to get stuff going to stderr

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

From novice to tech pro — start learning today.