You are viewing a plain text version of this content. The canonical link for it is here.
Posted to phoenix-dev@avalon.apache.org by Raj Saini <ra...@emerging-trade.com> on 2002/11/20 09:26:10 UTC

How to enable console logging in Phoenix

Hi,

The default output of logging in Phoneix is log files as defined in the 
assembly.xml. Is there a way to change the default output to console?

Thanks,

Raj Saini


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Mati,
    The problem is that you are redefining the same log category twice. 
 The second
one loading is overwriting the first most likely.  Unfortunately, logkit 
does not support
different log levels for different log targets (At least not that I am 
aware of :-)

    You need to change your categories section as follows:

<categories>
<category name="model-runner" log-level="DEBUG">
    <log-target id-ref="model-runner-target"/>
    <log-target id-ref="model-runner-target-info"/>
</category>
</categories>

Cheers,
Leif



mati wrote:

>  
>
>><logs version="1.1">
>><!--+ FACTORIES
>>      +   Factories define various types of output targets for log
>>messages
>>      +-->
>><factories>
>><factory type="stream"
>>class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >
>></factories>
>><!--+ TARGETS
>>      +   Targets are named destinations of log events. Tag names for
>>child
>>      +   elements, such as 'file' or 'screen', correspond to factory
>>types above.
>>      +-->
>><targets>
>><!-- Outputs events to the screen. -->
>><stream id="sout">
>>                 <stream>System.out</stream>
>><format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd)
>>HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}:
>>%{message}\n%{throwable}</format>
>></stream>
>></targets>
>><!--+ CATEGORIES
>>      +   Categories are named sinks for the application to output
>>events to.
>>      +   First level category names correspond to block names in
>>assembly.xml.
>>      +
>>      +   Each category has an attribute named log-level that
>>controls the severity
>>      +   of messages to records. Valid severities are:
>>      +     DEBUG, INFO, WARN, ERROR, FATAL_ERROR
>>      +
>>      +   Each category can have children of other categories, and
>>log-target elements
>>      +   log-target elements have an id-ref attribute that
>>references the id of a target
>>      +   in the targets section.
>>      +-->
>><categories>
>><!-- anything that doesn't fit into the above categories falls into
>>here -->
>><category name="" log-level="DEBUG">
>>                 <log-target id-ref="sout"/>
>></category>
>></categories>
>></logs>
>>    
>>
>
>
>I am trying to log to two targets at the same time and it fails. It just
>logs to one or another. Here is sample conf:
>
><factories>
>    <factory type="file"
>class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
>    <factory type="stream"
>class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
></factories>
>
><categories>
>
><category name="model-runner" log-level="DEBUG">
>    <log-target id-ref="model-runner-target"/>
></category>
>
><category name="model-runner" log-level="INFO">
><log-target id-ref="model-runner-target-info"/>
></category>
>
></categories>
>
>
><targets>
>
><file id="model-runner-target">
>    <filename>${app.home}/logs/model-runner.log</filename>
>    <format>%{time:dd/MM/yy HH:mm:ss} %5.5{priority} %{category}:
>%{message}\n%{throwable}    </format>
>    <append>true</append>
></file>
>
><stream id="model-runner-target-info">
>    <stream>System.out</stream>
>    <format type="avalon">%{time: HH:mm.ss:SSS} %{class:short}: %{message}
>\n</format>
></stream>
></targets>
>
>
>And it doesn't seem to work out
>
>Could somebody help me solve this so that it is logged to console and to
>file.
>
>Is it even possible to use two targets at the same time
>
>Mateusz Szczap
>mati@ncdc.pl
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by mati <ma...@ncdc.pl>.

> <logs version="1.1">
> <!--+ FACTORIES
>       +   Factories define various types of output targets for log
> messages
>       +-->
> <factories>
> <factory type="stream"
> class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >
> </factories>
> <!--+ TARGETS
>       +   Targets are named destinations of log events. Tag names for
> child
>       +   elements, such as 'file' or 'screen', correspond to factory
> types above.
>       +-->
> <targets>
> <!-- Outputs events to the screen. -->
> <stream id="sout">
>                  <stream>System.out</stream>
> <format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd)
> HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}:
> %{message}\n%{throwable}</format>
> </stream>
> </targets>
> <!--+ CATEGORIES
>       +   Categories are named sinks for the application to output
> events to.
>       +   First level category names correspond to block names in
> assembly.xml.
>       +
>       +   Each category has an attribute named log-level that
> controls the severity
>       +   of messages to records. Valid severities are:
>       +     DEBUG, INFO, WARN, ERROR, FATAL_ERROR
>       +
>       +   Each category can have children of other categories, and
> log-target elements
>       +   log-target elements have an id-ref attribute that
> references the id of a target
>       +   in the targets section.
>       +-->
> <categories>
> <!-- anything that doesn't fit into the above categories falls into
> here -->
> <category name="" log-level="DEBUG">
>                  <log-target id-ref="sout"/>
> </category>
> </categories>
> </logs>


I am trying to log to two targets at the same time and it fails. It just
logs to one or another. Here is sample conf:

<factories>
    <factory type="file"
class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
    <factory type="stream"
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
</factories>

<categories>

<category name="model-runner" log-level="DEBUG">
    <log-target id-ref="model-runner-target"/>
</category>

<category name="model-runner" log-level="INFO">
<log-target id-ref="model-runner-target-info"/>
</category>

</categories>


<targets>

<file id="model-runner-target">
    <filename>${app.home}/logs/model-runner.log</filename>
    <format>%{time:dd/MM/yy HH:mm:ss} %5.5{priority} %{category}:
%{message}\n%{throwable}    </format>
    <append>true</append>
</file>

<stream id="model-runner-target-info">
    <stream>System.out</stream>
    <format type="avalon">%{time: HH:mm.ss:SSS} %{class:short}: %{message}
\n</format>
</stream>
</targets>


And it doesn't seem to work out

Could somebody help me solve this so that it is logged to console and to
file.

Is it even possible to use two targets at the same time

Mateusz Szczap
mati@ncdc.pl


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by Peter Donald <pe...@apache.org>.
Would you consider adding this example to docs?

On Fri, 22 Nov 2002 05:33, Peter Royal wrote:
> On Thursday, November 21, 2002, at 04:08  AM, Raj Saini wrote:
> > It is not yet clear to me how to set the target to console. I have my
> > environment.xml file appended below. I shall be thankful if you can
> > make  required changes in the configuration below.
>
> Use the below block as the "logs" section of your environment.xml
> -pete
>
> 	<logs version="1.1">
> 		<!--+ FACTORIES
> 		      +   Factories define various types of output targets for log
> messages
> 		      +-->
> 		<factories>
> 			<factory type="stream"
> class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >
> 		</factories>
> 		<!--+ TARGETS
> 		      +   Targets are named destinations of log events. Tag names for
> child
> 		      +   elements, such as 'file' or 'screen', correspond to factory
> types above.
> 		      +-->
> 		<targets>
> 			<!-- Outputs events to the screen. -->
> 			<stream id="sout">
>                  <stream>System.out</stream>
> 				<format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd)
> HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}:
> %{message}\n%{throwable}</format>
> 			</stream>
> 		</targets>
> 		<!--+ CATEGORIES
> 		      +   Categories are named sinks for the application to output
> events to.
> 		      +   First level category names correspond to block names in
> assembly.xml.
> 		      +
> 		      +   Each category has an attribute named log-level that
> controls the severity
> 		      +   of messages to records. Valid severities are:
> 		      +     DEBUG, INFO, WARN, ERROR, FATAL_ERROR
> 		      +
> 		      +   Each category can have children of other categories, and
> log-target elements
> 		      +   log-target elements have an id-ref attribute that
> references the id of a target
> 		      +   in the targets section.
> 		      +-->
> 		<categories>
> 			<!-- anything that doesn't fit into the above categories falls into
> here -->
> 			<category name="" log-level="DEBUG">
>                  <log-target id-ref="sout"/>
> 			</category>
> 		</categories>
> 	</logs>

-- 
Cheers,

Peter Donald
 "Man's mind stretched to a new idea never goes back to its original 
dimensions." -Oliver Wendell Holmes 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by Peter Royal <pr...@apache.org>.
On Thursday, November 21, 2002, at 04:08  AM, Raj Saini wrote:
> It is not yet clear to me how to set the target to console. I have my  
> environment.xml file appended below. I shall be thankful if you can  
> make  required changes in the configuration below.

Use the below block as the "logs" section of your environment.xml
-pete

	<logs version="1.1">
		<!--+ FACTORIES
		      +   Factories define various types of output targets for log  
messages
		      +-->
		<factories>
			<factory type="stream"  
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >
		</factories>
		<!--+ TARGETS
		      +   Targets are named destinations of log events. Tag names for  
child
		      +   elements, such as 'file' or 'screen', correspond to factory  
types above.
		      +-->
		<targets>
			<!-- Outputs events to the screen. -->
			<stream id="sout">
                 <stream>System.out</stream>
				<format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd)  
HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}:  
%{message}\n%{throwable}</format>
			</stream>
		</targets>
		<!--+ CATEGORIES
		      +   Categories are named sinks for the application to output  
events to.
		      +   First level category names correspond to block names in  
assembly.xml.
		      +
		      +   Each category has an attribute named log-level that  
controls the severity
		      +   of messages to records. Valid severities are:
		      +     DEBUG, INFO, WARN, ERROR, FATAL_ERROR
		      +
		      +   Each category can have children of other categories, and  
log-target elements
		      +   log-target elements have an id-ref attribute that  
references the id of a target
		      +   in the targets section.
		      +-->
		<categories>
			<!-- anything that doesn't fit into the above categories falls into  
here -->
			<category name="" log-level="DEBUG">
                 <log-target id-ref="sout"/>
			</category>
		</categories>
	</logs>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by Raj Saini <ra...@emerging-trade.com>.
Hi Peter,

Thanks for the infomration.

It is not yet clear to me how to set the target to console. I have my 
environment.xml file appended below. I shall be thankful if you can make 
  required changes in the configuration below.

Raj

----------------------assembly.xml-----------------------------------------

<?xml version="1.0"?>

<environment>


     <logs>

	  <factory type="stream" 
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>

       <category name="" target="default"
                 priority="DEBUG" />
       <category name="objectstorage" target="objectstorage-target"
                 priority="DEBUG" />

       <log-target name="default"
                   location="/logs/oms-server.log" />
       <log-target name="objectstorage-target"
                   location="/logs/objectstorage.log" />

       <stream id="sout">
         <stream>System.out</stream>
         <format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd) 
HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}: 
%{message}\n%{throwable}</format>
       </stream>

     </logs>




     <policy>
       <grant code-base="sar:SAR-INF/lib/*">
         <permission class="java.security.AllPermission" />
       </grant>
     </policy>

</environment>

Peter Royal wrote:
> On Wednesday, November 20, 2002, at 12:26  AM, Raj Saini wrote:
> 
>> The default output of logging in Phoneix is log files as defined in  
>> the assembly.xml. Is there a way to change the default output to  
>> console?
>>
> 
> Be sure you are using logging 1.1 in environment.xml. Add a factory of:
> 
> <factory type="stream"  
> class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >
> 
> and a target of:
> 
>             <stream id="sout">
>                 <stream>System.out</stream>
>                 <format type="avalon">%8.8{priority} 
> %{time:(yyyy-MM-dd)  HH:mm.ss:SSS} [%8.8{category}] (%{thread}) 
> %{class:short}:  %{message}\n%{throwable}</format>
>             </stream>
> 
> If you give the 'id' the same value as the current default logger, you  
> will have everything redirected to the console.
> 
> -peter



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to enable console logging in Phoenix

Posted by Peter Royal <pr...@apache.org>.
On Wednesday, November 20, 2002, at 12:26  AM, Raj Saini wrote:
> The default output of logging in Phoneix is log files as defined in  
> the assembly.xml. Is there a way to change the default output to  
> console?
>

Be sure you are using logging 1.1 in environment.xml. Add a factory of:

<factory type="stream"  
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/ >

and a target of:

			<stream id="sout">
                 <stream>System.out</stream>
				<format type="avalon">%8.8{priority} %{time:(yyyy-MM-dd)  
HH:mm.ss:SSS} [%8.8{category}] (%{thread}) %{class:short}:  
%{message}\n%{throwable}</format>
			</stream>

If you give the 'id' the same value as the current default logger, you  
will have everything redirected to the console.

-peter
-- 
peter royal -> proyal@apache.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>