Forum Discussion
Algebraic_Mirror
Cirrostratus
Jan 30, 2018Proper way to do debugging in an iRule
What is the best way to place extra logging statements in an iRule for potential future debugging? If I have a statement like this, will it not print to the log until someone turns debug level loggin...
Lee_Sutcliffe
Nacreous
Jan 30, 2018One of the more common (and simplest) methods is to set a variable, if enabled it will log the messages to /var/log/ltm. To turn it on you just need to set the variable to 1, set to 0 to disable. Using a global static variable means you can use it in multiple iRules so you only need to enable/disable it in one place
when RULE_INIT {
set 1 to enable logging, 0 to disable
set static::debug 1
}
when HTTP_REQUEST {
some code....
if {$static::debug}{log local0. "logging is enabled"}
} Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
