Portlets deployed to MWS can use several different logging APIs. You can use whichever one you prefer.
For example:
//logging via log4j APIs
org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(getClass());
log4jLogger.info("Log Message from org.apache.log4j.Logger");
//logging via java built in logging APIs
java.util.logging.Logger juliLogger = java.util.logging.Logger.getLogger(getClass().getName());
juliLogger.info("Log Message from java.util.Logger");
//logging via apache commons logger
org.apache.commons.logging.Log oacLogger = org.apache.commons.logging.LogFactory.getLog(getClass());
oacLogger.info("Log Message from org.apache.commons.logging.Log");
//logging via the slf4j logging facade
org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger(getClass());
slf4jLogger.info("Log Message from org.slf4j.Logger");
The log messages for all of the above logging apis will displayed in the console and recorded in the MWS full.log
Hi all,
I am not able to get log details from CAF UI page which is logged for testing
Have used
org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(getClass());
log4jLogger.info("Log Message from org.apache.log4j.Logger");
or
System.out.println("Test Log");
But none of the log is appearing in any log file.
Please let me know if there is any alternate way to get the intermediate value printed in log file for testing.
Your log4j example looks correct to me. That log message would be written to the MWS full.log unless the administrator has configured the logging level for that appender to a level that is higher than ‘info’.
The System.out.println call would only write the message to the console window, it would not get routed to the MWS log file.