K2 Host Server Logging – MaxLifeTimeSpan

There is enough of documentation about K2 logging as well as blog post which cover how to enable and configure different logging types available in K2: host server logging, ADUM, SmO… For example there is a very good blog post “HOW DO I USE LOGGING IN K2?” which covers most of the things logging related.

Working on all sorts of support cases I most frequently have to switch around settings in ApplicationLevelLogSettings section of  HostServerLogging.config file:

K2 ApplicationLevelLogSettings section

Usually it is all about temporarily raising logging level so that we have more details logged for troubleshooting purposes. In case you have hard time remembering what level is maximum this picture may be helpful for you:

K2 logging levels

As usual when you use something routinely it makes you oblivious about other options and things which are readily available for you. In a way it is like that little known phenomenon of Hammer’s Bias (aka the law of the instrument/golden hammer) which is also largely forgotten idea of Abraham Maslow whose pyramid model enjoys the most of the limelight. So the other day I run into question on whether it is possible to roll over/cycle K2 host server log let’s say daily and whereas I clearly remember that by default it is being rolled over on each service restart I’m not sure if it has such settings. Quick glance at documentation brought to my attention extension specific sections in config which I largely ignore in my troubleshooting sessions – log extension specific properties:

K2 Extension specific log properties

In particular there is MaxLifetimeSpan property where you can set days/hour/minutes/seconds value which specifies time after which the log file cycles.  e.g. if you set the value to “1:0:0:00”, it will cycle every 1 day. Note that it works in combination with MaxFileSizeKB property, i.e. log file cycle happens depending on which condition become TRUE faster.

Now why it is so interesting/important. I think it may be a good idea for those who do operational support of K2 servers to configure their logs to cycle every 24 hour and restart their service at 00:00:00 (adjust MaxFileSizeKB so that 24 hours logging volume always fit into this size by adding generous safety margin). This will enable you to have very neat log files archive which will be a pleasure to work with as it is very easy to review logs for specific day as well as see the difference for specific date between night hours and business hours.

Leave a Reply

Your email address will not be published. Required fields are marked *