I like to make mine static in the non-tapestry pages:

        private static Logger logger = Logger.getLogger(DAOUtil.class);

Perhaps this is a good time to learn how I can use Tapestry IOC for
the non Tapestry portion of my web app?
That would be pretty cool.

Here is an excerpt from my log4j.properties.  I am just assuming slf4j
uses log4j.properties as well.

log4j.rootCategory=debug, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n

#log4j.category.org.apache.tapestry.TapestryFilter=debug
#log4j.category.org.apache.tapestry=error
#log4j.category.tapestry=error
org.acegisecurity=debug
log4j.category.com.mycompany.myapp=debug
log4j.category.com.mycompany.myapp.wui.tapestry.components.layout.recognizer=info
log4j.category.org.apache.tapestry=error
log4j.category.com.mycompany.myapp.wui.general.OldMenu=error
log4j.category.com.mycompany.myapp.wui.general.TreeMenu=error
log4j.logger.org.acegisecurity=DEBUG
#log4j.category.app=error
#log4j.category.app.TimingFilter=debug

# Turning on debug mode for a page or component will show all of the
code changes that occur when the
# class is loaded.  Turning on debug mode for a page will enable
verbose output about rendering
# the page (and its components).
# log4j.category.org.example.myapp.pages.Start=debug

### Hibernate logging options ###
log4j.logger.net.sf.hibernate=debug
### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=debug
### log PreparedStatement cache activity ###
log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=debug








On Jan 8, 2008 3:38 AM, Davor Hrg <[EMAIL PROTECTED]> wrote:
> for tapestry services just define "Logger logger" as constructor parameter..
>
>
> Davor Hrg
>
>
> On Jan 8, 2008 9:22 AM, Steph <[EMAIL PROTECTED]> wrote:
> > How do you get your logger in your code ?
> > The injection
> >     @Inject
> >     private Logger log;
> > is only useable in Tapestry pages, components, ...
> > It will log nothing in your other classes managed by Spring, Hibernate, ...
> > Outside of Tapestry, you should use something like the line below to use
> > slf4j :
> >     private final Logger log = LoggerFactory.getLogger(YourClass.class);
> >
> > Stephane
> >
> > Andy Huhn a écrit :
> >
> > > Hi Buckofive,
> > >
> > > Here are a couple of relevant lines from my log4j.properties file.  My
> > > file is in src/main/resources:
> > >
> > > log4j.logger.org.hibernate=info
> > >
> > > ### log HQL query parser activity
> > > #log4j.logger.org.hibernate.hql.ast.AST=info
> > >
> > > ### log just the SQL
> > > log4j.logger.org.hibernate.SQL=debug
> > >
> > > This seems to be logging what I expect.
> > >
> > > Andy
> > >
> > > On Mon, 2008-01-07 at 15:07 -0800, buckofive wrote:
> > >
> > >> Is no one else having issues logging 3rd party libraries?  I am unable 
> > >> to get
> > >> any hibernate or spring logs.  I have tried creating several different
> > >> tapestry test projects using the 5.0.7 archetype but with I still get
> > >> nothing.  They all seem to only log tapestry framework and "my pages" 
> > >> logs.
> > >> Could someone who has success logging hibernate post their 
> > >> log4j.properties
> > >> file? Please. Pretty Please ... with sugar on top.
> > >>
> > >> thanks,
> > >> B
> > >>
> > >>
> > >>
> > >> buckofive wrote:
> > >>
> > >>> Hi all,
> > >>>
> > >>> I'm stuck at the moment trying to get log4j to log any 3rd party
> > >>> libraries.  It seems to work fine for classes within my web project(ie
> > >>> page classes etc.) and if I set the root level to debug I get what looks
> > >>> like mostly  web container statements.  Any help would be much
> > >>> appreciated.
> > >>>
> > >>> Here is a very basic version of my log4j.properties file:
> > >>>
> > >>> [code]
> > >>> log4j.rootCategory=WARN, A1
> > >>>
> > >>> # A1 is set to be a ConsoleAppender.
> > >>> log4j.appender.A1=org.apache.log4j.ConsoleAppender
> > >>>
> > >>> # A1 uses PatternLayout.
> > >>> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> > >>> log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n
> > >>>
> > >>> log4j.category.org.apache.tapestry.TapestryFilter=info
> > >>> log4j.category.org.apache.tapestry=error
> > >>> log4j.category.tapestry=error
> > >>>
> > >>> log4j.category.com.jpa=error
> > >>>
> > >>> # Service category names are the name of the defining module class
> > >>> # and then the service id.
> > >>> log4j.category.com.jpa.services.AppModule.TimingFilter=info
> > >>>
> > >>> log4j.category.org.hibernate=debug
> > >>>
> > >>> [/code]
> > >>>
> > >>>
> > >>> Whats weird is these settings works fine in a non-tapestry application. 
> > >>>  I
> > >>> created my project with the tapestry 5.0.7 archetype and my file is
> > >>> located in <project>\src\main\resources\log4j.properties.  Am I missing
> > >>> something or doing something wrong?
> > >>>
> > >>> thanks in advance,
> > >>> B
> > >>>
> > >>>
> > >>>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to