You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rolf Schumacher <ro...@hamburg.de> on 2004/05/01 20:43:43 UTC

Re: Logging in cocoon

John L. Webber wrote:

> Anna,
>
> There's a very detailed article on the Cocoon Wiki: 
> http://wiki.cocoondev.org/Wiki.jsp?page=ConfiguringTheLogs
>
> Anna Bikkina wrote:
>
>> Hi,
>>
>> I want to log some details to a user defined log file(specified in 
>> web.xml).
>> How can I do that from my xsp,java and xsp files used in the cocoon. 
>> Can someone please direct me to some examples.
>>  
>>
>
Anna, do you managed to use Cocoons log facilities?
I don't. Maybe I'm too blind to see "how simple" it is
or this might be a facility for those super smart people
of the (ever shrinking) inner circle.

Rolf

Re: Logging in cocoon

Posted by Rolf Schumacher <ro...@hamburg.de>.
Sorry, was too blind to see how simple the ingenius avalon/cocoon people 
had made logging.

For all those who likes "hello world" to start with:

...
import org.apache.log.Hierarchy;
import org.apache.log.Logger;
...
    private Logger logger;
...
            logger = Hierarchy.getDefaultHierarchy().getLoggerFor("myLog");
...
            logger.info( "hello world" );
...

With additions to logkit.xconf:

in targets:
<cocoon id="myLog">
  <filename>${context-root}/WEB-INF/logs/myLog.log</filename>
  <format type="cocoon">         %7.7{priority} %{time} %{category}: 
%{message}\n%{throwable}</format>
  <append>false</append>
</cocoon>

in catagories:
<category log-level="INFO" name="myLog">
  <log-target id-ref="myLog"/>
</category>

The result appears in myLog.log in the directory where all other cocoon 
logs get written to.

Rolf

Rolf Schumacher wrote:

> John L. Webber wrote:
>
>> Anna,
>>
>> There's a very detailed article on the Cocoon Wiki: 
>> http://wiki.cocoondev.org/Wiki.jsp?page=ConfiguringTheLogs
>>
>> Anna Bikkina wrote:
>>
>>> Hi,
>>>
>>> I want to log some details to a user defined log file(specified in 
>>> web.xml).
>>> How can I do that from my xsp,java and xsp files used in the cocoon. 
>>> Can someone please direct me to some examples.
>>>  
>>>
>>
> Anna, do you managed to use Cocoons log facilities?
> I don't. Maybe I'm too blind to see "how simple" it is
> or this might be a facility for those super smart people
> of the (ever shrinking) inner circle.
>
> Rolf