-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 4:46 am 
Newbie

Joined: Fri May 05, 2006 11:27 am
Posts: 8
I was able to start with NHibernate in just a couple of days. I'm happy about this so I assume I can propose it as access layaer for wrapping the DB in my company.
There is one issue still not resolved: the access time. It seems to be longer than ado.net immediate access, and that's resonable, but it seems too much long!
I was wondering if this is due also to the console.out.print that is produced and the log4net.xml to be wirtten.
I read about log4j logging system, but I do not found any explanation on how to enable or disable. I read about the log4j.properties file, but I have not included it on my VS solution. Moreover I was not able to find an example for NHibernate on the net too!

How can I disable the log to check the access speed, again?

Do you have any log4j.properties example that I can add to my project and try to disable it?

Thanks for any help,
ema


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 5:03 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
emanuele.ornella wrote:
I read about log4j logging system, but I do not found any explanation on how to enable or disable. I read about the log4j.properties file, but I have not included it on my VS solution.


It is actually log4net logging system. You searched for wrong thing.

The log4net configuration is usually done trough <log4net> section in application configuration file (app.config or web.config)

Gert


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 5:30 am 
Newbie

Joined: Fri May 05, 2006 11:27 am
Posts: 8
Thanks gert!
there is a reason why I'm a newbi :-) I was wondering why in the net there was any example.

Anyway I found a similar post in codeguru asp.net forum
(http://www.codeguru.com/forum/showthread.php?t=376724)
but with no answer.

The immediate question is how can I STOP the log ? I never configure it to display anything, but it print out a lot of lines!

thanks,
ema

gert wrote:
emanuele.ornella wrote:
I read about log4j logging system, but I do not found any explanation on how to enable or disable. I read about the log4j.properties file, but I have not included it on my VS solution.


It is actually log4net logging system. You searched for wrong thing.

The log4net configuration is usually done trough <log4net> section in application configuration file (app.config or web.config)

Gert


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 6:04 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
emanuele.ornella wrote:

The immediate question is how can I STOP the log ? I never configure it to display anything, but it print out a lot of lines!



Probably something like
Code:

  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
  [..cut..]
  <!-- This section contains the log4net configuration settings -->
  <log4net>
    <!-- levels: DEBUG, INFO, WARN, ERROR, FATAL -->
    <root>
      <level value="ERROR"/>
    </root>
  </log4net>

in configuration file and
Code:
log4net.Config.XmlConfigurator.Configure();

in application initialization code should help.

Gert


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 8:06 am 
Newbie

Joined: Fri May 05, 2006 11:27 am
Posts: 8
Still not working damn!
Now I understood: in the app.config I have to add the log4net configuration tags.
You suggest me to place as priority ERROR so that only errors will be displayed.
I try to copy and past what I found in the web(http://wiki.nhibernate.org/display/NH/C ... et+Logging)

Code:
   <!-- This section contains the log4net configuration settings -->
   <log4net debug="false">

      <!-- Define some output appenders -->
      <appender name="trace" type="log4net.Appender.TraceAppender, log4net">
         <layout type="log4net.Layout.PatternLayout,log4net">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &amp;lt;%P{user}&amp;gt; - %m%n" />
         </layout>
      </appender>

      <appender name="console" type="log4net.Appender.ConsoleAppender, log4net">
         <layout type="log4net.Layout.PatternLayout,log4net">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &amp;lt;%P{user}&amp;gt; - %m%n" />
         </layout>
      </appender>

      <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" >
         
         <param name="File" value="log.txt" />
         <param name="AppendToFile" value="true" />
         <param name="RollingStyle" value="Date" />
         <param name="DatePattern" value="yyyy.MM.dd" />
         <param name="StaticLogFileName" value="true" />

         <layout type="log4net.Layout.PatternLayout,log4net">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &amp;lt;%X{user}&amp;gt; - %m%n" />
         </layout>
      </appender>

      <!-- Setup the root category, add the appenders and set the default priority -->
      
      <root>
         <priority value="INFO" />
         <appender-ref ref="console" />
      </root>
   </log4net>



I also added the
Code:
log4net.Config.XmlConfigurator.Configure();

line on the application code.

But I recived an expetion:
Error: System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Configuration' threw an exception. ---> System.TypeInitializationException: The type initializer for 'log4net.Core.LoggerManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'log4net.Util.LogLog' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section log4net. (c:\Project\RegistrazioniMagazzino\RegistrazioniMagazzino\bin\Debug\RegistrazioniMagazzino.vshost.exe.config line 30)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)


Then I deleted all the appender tags leaving only:


Code:

<!-- This section contains the log4net configuration settings -->
  <log4net debug="false">
       <root>
      <priority value="ERROR" />
      <appender-ref ref="console" />
    </root>
  </log4net>


But still have the same error.

If I remove all the log4net tags I receive no error (but I have the default inizialization from NHibernate as before so that I have it enable agian!)

Thanks for any other help you can give me.
ema


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 8:13 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
emanuele.ornella wrote:
Still not working damn!
Now I understood: in the app.config I have to add the log4net configuration tags.


Yes. But be sure You have
Code:
  <configSections>
    ...
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
    ...
  </configSections>

also present in configuration file (The .Net configuration system is quite a picky animal...)

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 8:22 am 
Newbie

Joined: Fri May 05, 2006 11:27 am
Posts: 8
Thanks Gert!
I had this working now.
I copy & paste your line and got it work.
I had that line before but probably not so well written!

Thanks again!

But I still have in the Output window a lot of print out such as:

Code:
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded '9zl-nn5q', No symbols loaded.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded '4a39dswf', No symbols loaded.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded 'g2fr5wea', No symbols loaded.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded 'f59pgjms', No symbols loaded.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded '6d4z64ej', No symbols loaded.
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded '06ylgftv', No symbols loaded.


Does it belong to log4net? At this time I'm not sure any more! And then: does it affect the performances?

thanks,
ema


Top
 Profile  
 
 Post subject: Re: log4j.properties and the access speed issue
PostPosted: Wed May 10, 2006 8:29 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
emanuele.ornella wrote:
Code:
'RegistrazioniMagazzino.vshost.exe' (Managed): Loaded '9zl-nn5q', No symbols loaded.


Does it belong to log4net? At this time I'm not sure any more! And then: does it affect the performances?


Those should belong to reflection optimization included in NHibernate. Slows down the startup, but should speed up overall perfomance.

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.