Shapira, Yoav | 7 Dec 2004 15:38

RE: Logging best practices?


Hi,
You're asking for best practices, right?

>This is fine and has been working for us. However, now we are moving
into
>managed regions, which equate to a test, qa and prod regions. The
problem
>now becomes a question of managing the logging level depending on what
>region we are in.
>
>We do not have the ability to change the application property files
once it
>moves into Test and all files from Test get moved up to QA. All files
from
>QA eventually move up to Prod. So, as you can see, if we turn on
logging in
>Test, then that logging will be on in Prod, which we do not want.

This is far from a best practice.  It is expected that code and tests
remain the same across environments, but configuration is subject to
change.

You could consider programmatic configuration that takes into account
the environment, but the best solution is to have a different log4j
configuration file for each environment to fit your needs for that
environment.  You can have your build script fill in relevant things
automatically by using Ant filter tokens, for example.

Yoav Shapira http://www.yoavshapira.com
(Continue reading)


Gmane