logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Søren Ehrhorn <soeren.ehrh...@jyskebank.dk>
Subject RE: ObjectRenders
Date Fri, 04 Jun 2004 07:46:49 GMT
Hello again,

So far so good, but i still have a problem. In the manual there is a
referense to a  configuration file, objectRendering.xml in chapter3 but its
not there! I dont know the structure of how its ment to be implementet. I
have a configuration file as listet here:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<!-- THIS IS THE WORKSTATION LOG4J CONFIGURATION FILE -->

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
		<!-- Denne Appender benyttes fra og med DEBUG level og
opefter -->
		<param name="Threshold" value="DEBUG"/>
		<param name="Target" value="System.out"/>
		<layout class="dk.jyskebank.j2ee.core.dump.DumpLayout">
			<param name="ConversionPattern" value="%d %-5p [%t]
%C{2} (%l) - %m\n" />
		</layout>
	</appender>
		
	<root>
		<priority value="debug"></priority>
		<appender-ref ref="CONSOLE"/> 
	</root>
</log4j:configuration>

I would like to be able to construct a render for my loggable objects but as
im trying to explain i wery bad english, i dont know how and there. Can you
help me?

Best regards
- Søren

-----Original Message-----
From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] 
Sent: 3. juni 2004 14:56
To: Log4J Users List
Subject: RE: ObjectRenders



Hi,
ObjectRenderers do not replace a Layout.  They are classes that know how to
render objects of a specific class.  For example:

class A {
  private int a;
  public int getA() { return a; }
   
  private int b;
  public int getB() { return b; }
}

public class ARenderer implements ObjectRenderer {
  public String doRender(Object o) {
    if(o == null) {
      return null;
    } else if {! (o instanceof A)) {
      return null;
    } else {
      A obj = (A) o;
      return "Sum = " + (obj.getA() + obj.getB());
    }
}

They are specified in a properties configuration file as follows:
log4j.renderer.A = ARenderer

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Søren Ehrhorn [mailto:soeren.ehrhorn@jyskebank.dk]
>Sent: Thursday, June 03, 2004 7:36 AM
>To: 'log4j-user@logging.apache.org'
>Subject: ObjectRenders
>
>Hi,
>
>Im trying to incorperate ObjectRenders in min J2EE framework, but i 
>dont know howto. Do they replase Layout??
>
>
>Regards,
>Søren
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message