Separate log within same application

I use logback in my application to log errors and, if necessary, warnings and info. It's set up and it works great. I'd like to have a separate log that keeps track of user activity within our admin tools. For example, say user x deleted some information using the admin tools, I'd like to log that. In some cases there might be both error logging and user behavior logging in the same class. I'm not clear on how you would separate the two, since I'm using the LoggerFactory with the class name: final static Logger logger = LoggerFactory.getLogger(UserDB.class); What would be the best way of doing this? TIA, John

Hi John, There is an alternate version of "getLogger" that takes a string, which can be anything and specifies the name of the logger. The form that takes a class sets the logger's name to be the full class name. final static Logger securityLogger = LoggerFactory.getLogger("securityLogger"); You would want to make sure that ALL logging is turned on for the security logger at all times. On Thu, Sep 25, 2014 at 12:01 PM, John Smith <tomcat.random@gmail.com> wrote:
I use logback in my application to log errors and, if necessary, warnings and info. It's set up and it works great.
I'd like to have a separate log that keeps track of user activity within our admin tools. For example, say user x deleted some information using the admin tools, I'd like to log that.
In some cases there might be both error logging and user behavior logging in the same class. I'm not clear on how you would separate the two, since I'm using the LoggerFactory with the class name:
final static Logger logger = LoggerFactory.getLogger(UserDB.class);
What would be the best way of doing this?
TIA, John
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Family photographs are a critical legacy for ourselves and our descendants. Protect that legacy with a digital backup and recovery plan.

Not sure whether really helps http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html You can configure logback.xml according to your requirement. On Thu, Sep 25, 2014 at 9:43 PM, Donald McLean <dmclean62@gmail.com> wrote:
Hi John,
There is an alternate version of "getLogger" that takes a string, which can be anything and specifies the name of the logger. The form that takes a class sets the logger's name to be the full class name.
final static Logger securityLogger = LoggerFactory.getLogger("securityLogger");
You would want to make sure that ALL logging is turned on for the security logger at all times.
On Thu, Sep 25, 2014 at 12:01 PM, John Smith <tomcat.random@gmail.com> wrote:
I use logback in my application to log errors and, if necessary, warnings and info. It's set up and it works great.
I'd like to have a separate log that keeps track of user activity within our admin tools. For example, say user x deleted some information using the admin tools, I'd like to log that.
In some cases there might be both error logging and user behavior logging in the same class. I'm not clear on how you would separate the two, since I'm using the LoggerFactory with the class name:
final static Logger logger = LoggerFactory.getLogger(UserDB.class);
What would be the best way of doing this?
TIA, John
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Family photographs are a critical legacy for ourselves and our descendants. Protect that legacy with a digital backup and recovery plan.
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Srikanth www.srikanthugar.in

Thanks. That seems easy. When you say "You would want to make sure that ALL logging is turned on for the security logger at all times" are you just saying the log level of "securityLogger" is set to the same in the config? ie: <logger name="securityLogger" level="INFO"> ... securtyLogger.info("..."); On Thu, Sep 25, 2014 at 12:13 PM, Donald McLean <dmclean62@gmail.com> wrote:
Hi John,
There is an alternate version of "getLogger" that takes a string, which can be anything and specifies the name of the logger. The form that takes a class sets the logger's name to be the full class name.
final static Logger securityLogger = LoggerFactory.getLogger("securityLogger");
You would want to make sure that ALL logging is turned on for the security logger at all times.
On Thu, Sep 25, 2014 at 12:01 PM, John Smith <tomcat.random@gmail.com> wrote:
I use logback in my application to log errors and, if necessary, warnings and info. It's set up and it works great.
I'd like to have a separate log that keeps track of user activity within our admin tools. For example, say user x deleted some information using the admin tools, I'd like to log that.
In some cases there might be both error logging and user behavior logging in the same class. I'm not clear on how you would separate the two, since I'm using the LoggerFactory with the class name:
final static Logger logger = LoggerFactory.getLogger(UserDB.class);
What would be the best way of doing this?
TIA, John
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Family photographs are a critical legacy for ourselves and our descendants. Protect that legacy with a digital backup and recovery plan.
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

Hi John, Yes, INFO, or I think that ALL works as well. On Thu, Sep 25, 2014 at 12:25 PM, John Smith <tomcat.random@gmail.com> wrote:
Thanks. That seems easy.
When you say "You would want to make sure that ALL logging is turned on for the security logger at all times" are you just saying the log level of "securityLogger" is set to the same in the config? ie:
<logger name="securityLogger" level="INFO"> ... securtyLogger.info("...");
On Thu, Sep 25, 2014 at 12:13 PM, Donald McLean <dmclean62@gmail.com> wrote:
Hi John,
There is an alternate version of "getLogger" that takes a string, which can be anything and specifies the name of the logger. The form that takes a class sets the logger's name to be the full class name.
final static Logger securityLogger = LoggerFactory.getLogger("securityLogger");
You would want to make sure that ALL logging is turned on for the security logger at all times.
On Thu, Sep 25, 2014 at 12:01 PM, John Smith <tomcat.random@gmail.com> wrote:
I use logback in my application to log errors and, if necessary, warnings and info. It's set up and it works great.
I'd like to have a separate log that keeps track of user activity within our admin tools. For example, say user x deleted some information using the admin tools, I'd like to log that.
In some cases there might be both error logging and user behavior logging in the same class. I'm not clear on how you would separate the two, since I'm using the LoggerFactory with the class name:
final static Logger logger = LoggerFactory.getLogger(UserDB.class);
What would be the best way of doing this?
TIA, John
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Family photographs are a critical legacy for ourselves and our descendants. Protect that legacy with a digital backup and recovery plan.
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Family photographs are a critical legacy for ourselves and our descendants. Protect that legacy with a digital backup and recovery plan.
participants (3)
-
Donald McLean
-
John Smith
-
Srikanth Hugar