Computing Magazine

How to Enable DEBUG Logging In CloudHub

Posted on the 13 July 2017 by Abhishek Somani @somaniabhi
cloudHub ignores the local log4j.xml configuration and even if we enable DEBUG logging in the xml file , and deploy it in cloudhub , we see no changes . To enable logging in cloud hub , we can add following configurations in out log4j .xml

<Log4J2CloudhubLogAppender name="CLOUDHUB"
addressProvider="com.mulesoft.ch.logging.DefaultAggregatorAddressProvider"
applicationContext="com.mulesoft.ch.logging.DefaultApplicationContext"
appendRetryIntervalMs="${sys:logging.appendRetryInterval}"
appendMaxAttempts="${sys:logging.appendMaxAttempts}"
batchSendIntervalMs="${sys:logging.batchSendInterval}"
batchMaxRecords="${sys:logging.batchMaxRecords}"
memBufferMaxSize="${sys:logging.memBufferMaxSize}"
journalMaxWriteBatchSize="${sys:logging.journalMaxBatchSize}"
journalMaxFileSize="${sys:logging.journalMaxFileSize}"
clientMaxPacketSize="${sys:logging.clientMaxPacketSize}"
clientConnectTimeoutMs="${sys:logging.clientConnectTimeout}"
clientSocketTimeoutMs="${sys:logging.clientSocketTimeout}"
serverAddressPollIntervalMs="${sys:logging.serverAddressPollInterval}"
serverHeartbeatSendIntervalMs="${sys:logging.serverHeartbeatSendIntervalMs}"
statisticsPrintIntervalMs="${sys:logging.statisticsPrintIntervalMs}">
<PatternLayout pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t] CUSTOM: %m%n"/>
</Log4J2CloudhubLogAppender>
And add this appender along with your file appender .

<AppenderRef ref="CLOUDHUB"/>
Now you can deploy it on cloud hub and it should work fine . You can also change Additional log levels and categories to include in logs in cloud hub . Just click on Manage Application -> Settings -> Logging There you can see logging levels , select desired logging level from drop down and write your package name , like com.mulesoft . And then click on apply changes . And those changes will be affected in your cloudhub logs How to enable DEBUG Logging In CloudHub Provide Comments and Suggestions !!!

Back to Featured Articles on Logo Paperblog