I want my tomcat web app to use one logging configuration file during development, but a different logging configuration file for deployment.
Is there any way to accomplish this? If I put a logging.properties file in the root of my class loader for deployment, that seems to take priority over everything else, so I don’t see a way to add a runtime jvm flag or anything like that to override the configuration during development.
You can use
-Dcommand-line option in Tomcat. Create two properties file for development and deployment.Add something like this in development let say log.properites
In deployment log.properties add
Now use
-Dcommand-line optionjava -Dlogging.config=logging.properties -jar mywar.warWhat will happen internally is
-Dlogging.config=log.propertiesoption overrides the development logging configuration in thelog.propertiesfile, and the application will use the deployment logging configuration in thelog.propertiesfile.note : I have tested in my system.