Forums de discussion
Custom Log Level In Liferay
Mohammad Azharuddin, modifié il y a 8 années.
Custom Log Level In Liferay
Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
HI .. Is it posible to add custom log level in liferay 6.2..?
Meera Prince, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Liferay Legend Publications: 1111 Date d'inscription: 08/02/11 Publications récentes
Hi
this may help you.
https://www.liferay.com/community/wiki/-/wiki/Main/How+to+create+custom+logging
Regards,
Meera Prince
this may help you.
https://www.liferay.com/community/wiki/-/wiki/Main/How+to+create+custom+logging
Regards,
Meera Prince
Mohammad Azharuddin, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
Thanks Prince .. But i was looking to add new level , between info and debug level..
David H Nebinger, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
No you cannot define your own logging level.
Log levels are defined by the underlying logging framework, not by Liferay or your code.
Log levels are defined by the underlying logging framework, not by Liferay or your code.
Mohammad Azharuddin, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
Hi David
Thank You I could able to create my own custom log level in liferay using EXT plugin as underlying logging framework is extended by Liferay .. It is working as expected and also i could able to configure the custom level in control panel as Well.
Thank You I could able to create my own custom log level in liferay using EXT plugin as underlying logging framework is extended by Liferay .. It is working as expected and also i could able to configure the custom level in control panel as Well.
David H Nebinger, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
Liferay uses log4j for logging; you wouldn't need an EXT plugin to hack in your new logging level.
A quick google search turned up http://crunchify.com/java-how-to-create-your-own-logging-level-in-log4j-configuring-log4j/.
So technically you could hack in a custom level, but using it would be a PITA as you won't be able to do the simpler log.debug() calls, you'd have to use log.log() method which would take the custom logging level as an argument.
All you'd need to do is create a jar and copy it everywhere you find log4j.jar.
Even if you did this, my statement generally still stands - it's not something done/defined in Liferay and Liferay wouldn't actually use your logging level at all.
A quick google search turned up http://crunchify.com/java-how-to-create-your-own-logging-level-in-log4j-configuring-log4j/.
So technically you could hack in a custom level, but using it would be a PITA as you won't be able to do the simpler log.debug() calls, you'd have to use log.log() method which would take the custom logging level as an argument.
All you'd need to do is create a jar and copy it everywhere you find log4j.jar.
Even if you did this, my statement generally still stands - it's not something done/defined in Liferay and Liferay wouldn't actually use your logging level at all.
Mohammad Azharuddin, modifié il y a 8 années.
RE: Custom Log Level In Liferay
Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
Thanks David
I used almost same approach but i wanted new level to be available in LogFactoryUtil API and new level to be available to customize in Control Panel,Server Administrator so i go for EXT
private static Log _log = LogFactoryUtil.getLog(XYZ.class);
_log .crunchify("I am CrunchifyLog4jLevelTest log");
I used almost same approach but i wanted new level to be available in LogFactoryUtil API and new level to be available to customize in Control Panel,Server Administrator so i go for EXT
private static Log _log = LogFactoryUtil.getLog(XYZ.class);
_log .crunchify("I am CrunchifyLog4jLevelTest log");