Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Management Webjects > Write-Log
  
Write-Log
DESCRIPTION
Writes a message to the log associated with the context in which it is executed. For example, if the webject is called from a task executed within the Info*Engine task processor, the message is written to the task processor log. If the webject is called from a JSP page, it is written to the JSP processor log.
* 
When writing Info*Engine tasks, it is preferable to make use of the Logging tag library to issue log statements to log4j.
SYNTAX
<ie:webject name="Write-Log" type="MGT">
  <ie:param name="GROUP_IN" data="input_group"/>
  <ie:param name="LOG" data="[DEBUG | INFO | ERROR | AUDIT |
                                         TRANSACTION | STAT]"/>
  <ie:param name="MESSAGE" data="message_text"/>
  <ie:param name="TAG" data="author_supplied_tag"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
GROUP_IN
LOG
MESSAGE
TAG
GROUP_IN
Specifies the name of the input group to log. The input group is rendered as XML and written to the log file specified by the LOG parameter. Multiple values can be specified. Any input groups are logged after the values supplied on the MESSAGE parameter.
LOG
Specifies the log to which the message should be written. Valid values for this parameter are DEBUG, INFO, ERROR, AUDIT, TRANSACTION, and STAT. The default for this parameter is INFO. This parameter is optional.
MESSAGE
Provides the main text of the message to be written to the log.
The format of each log message written is:
date-time#:#host#:#service#:#tag#:#user#:#messagevalue
where:
date-time—The date and time at which the message is written.
host—The Internet domain name of the host from which the message is written.
service—The name of the Info*Engine service that wrote the message.
tag—The value specified by the TAG parameter.
user—The authenticated username of the user for which the service was working when the message is written.
messagevalue—The value specified by the MESSAGE parameter.
The default is for a log message to be written that has an empty message value. This parameter is optional.
TAG
Specifies a tag that is written as part of the log entry for the purpose of facilitating the searching and sorting of logs. The TAG parameter allows a task author to provide a simple identifier that can be used to distinguish one kind of log message from another. For example, you can use special tags for troubleshooting purposes, or to classify messages in site-defined ways.
The default for this parameter is to use the name of the task from which the webject is being called. This parameter is optional.
EXAMPLE
The following Write-Log example JSP page creates a group, writes messages to two different logs, and displays the output:
<%@page language="java"
  session="false"
  errorPage="../IEError.jsp"%>
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie" %>

<html>
<head>
<title>Write-Log Webject</title>
</head>
<body>

<!-- create a group -->
<ie:task uri="com/company/CreateGroup.xml"/>

<!-- Write a log message to the default log, "info" -->

<ie:webject name="Write-Log" type="MGT">
  <ie:param name="TAG" data="-----Write-Log-----"/>
  <ie:param name="MESSAGE" data="----Info log message----"/>
</ie:webject>

<!-- Write a log message to the "debug" log -->
<ie:webject name="Write-Log" type="MGT">
  <ie:param name="TAG" data="-----Write-Log-----"/>
  <ie:param name="MESSAGE"
                          data="----Debug log message----"/>
<ie:param name="LOG" data="DEBUG"/>
</ie:webject>

<!-- generate the output -->
<ie:webject name="Display-Table" type="DSP"/>

</body>
</html>