Popular Posts

Monday, January 13, 2014

DataPower Logging - LogTargets & LogCategory (Part 1)

DataPower has provided easy way to allow developers to create log entries or capture information related to a transaction. If you are familiar with Java, it's more like log4j where you have appenders and log levels. Before I dive into implementation details, let me start with few important words and their definitions

1. Log Category - DataPower comes with few default log category and also allows to create new ones. Think log category as tags. Say if you want to generate some logs, you can tag each log entry. The purpose is to differentiate logs by applying tags. Say from your XSL you want to generate 5 different kind of logs, then you can just have 5 different tags. Each log entry will be fired with the specified log category.

2. Event priority - is like log levels. DataPower doesn't provide any option to create new priorities. Few examples that comes with DataPower emergency, error, debug, information etc. 

3. Log Target -  Log target capture logs fired by services or object. Log targets are like appenders. You can have as many targets as you want. Targets allow logs to captured in DataPower files system or send to a remote server using protocol HTTP, Syslog, SMTP or NFS. Each log targets subscribes to combination of log category and event priority.

Note: DataPower comes up with a default LogTarget that capture all log categories including customs if created on debug level and mgmt on notice level.












To create a new Log Category, search Log Category from search text box from left menu bar.
Create a new one and apply. In this case, I have create "ProjectLog01".












Now you can create a new LogTarget say "ProjectTarget01". In this log target, I've subscribed new log category with event priority "debug" which means debug or all other log entries above debug will be captured.















For example below xsl:message statement will generate a log for default log category "xsltmsg"


And this one will generate a log for "ProjectLog01" category. LogTarget "ProjectTarget01" created above will capture this entry.



Please put your comments if you have any specific question about DataPower logging. I will cover Probe and some other feature of DataPower in next few postings.

6 comments:

  1. the logs with custom category is getting generated but with zero bytes. Let me know what has to be done.

    ReplyDelete
  2. Hi Akansha, do you mean you can see the log file created but with no logs inside? It might be because you are not using custom category in your XSL message syntax.

    ReplyDelete
  3. @Akansha, at first the log file will be created with 0 bytes. Once a request is triggered and the custom log category is invoked, the log file will be appended with data.

    ReplyDelete
  4. @Akansha, at first the log file will be created with 0 bytes. Once a request is triggered and the custom log category is invoked, the log file will be appended with data.

    ReplyDelete
  5. how to prevent server banner disclosure in response using datapower.
    client is able to see server details in response headers.

    ReplyDelete