0

Working in both development and deployment environment, I want my log4j.properties to have include console appender, so I could view log messages when I develop. However when I deploy the application, I prefer to disable the console appender.

Is there a filter I can add on the console appender to do this?

Nivetha T
  • 481
  • 1
  • 3
  • 17
Dudi
  • 2,340
  • 1
  • 24
  • 39

1 Answers1

2

Deploy the application with a different log4j config file, that's why it's an external file.

artbristol
  • 32,010
  • 5
  • 70
  • 103
  • 1
    I was hoping to a more elegant method. e.g. have log4J use console appender only on localhost... Your solution requires me to have my build (maven) augmented with profiles – Dudi Jan 30 '15 at 13:59
  • @Dudi yeah, profiles can be a pain. But there is fiddling to do when you move an application from development to production, and logging config is always going to be one of them. – artbristol Jan 30 '15 at 14:42