Nhibernate and log4net logs - nhibernate

I have a customer using an application called 'Nhibernate' and a plugin called Log4net. Both work in conjunction to generates a log file.
My problem is that once nhibernate.log reaches more than 200MB a new file is generated and the old file is renamed NHibernate.log.1
Is there way to avoid the segmentation of the log files and makes the log readable even after 200MB.
Thank you for your responses.
Regards.

You can open the NHibernate.log.1 with any text editor. If you open the configuration file you can change the logname pattern for the NHibernate logger file property.
If you want all in one file you can change the appender to a normal fileappender.
An link to an older blog with some information on how to do the configuration for the NHibernate appender: http://geekswithblogs.net/opiesblog/archive/2006/09/29/92721.aspx

Log4net has a configurator that defines the max size of the file and the number of extra files created after reaching this max size.
If you want everything on a single file, you can re-defines these properties.
You probably have an .config file or on your app.config/web.config an set of xml properties that defines these parameters.
This is an example of the property you are looking for:
<maximumFileSize value="200MB" />

Related

Error in mule start up due to long properties file

I am facing one weird issue while running mule application. We have multiple entries in mule-app.properties (220 lines
). When I try to run the application, it fails with file or extension too error.
When I remove some random entries from properties file, application starts successfully. Any help will be appreciated.
I have had a similar issue to this, and it because of the way the entries in mule-app.properties are applied at runtime. The JVM is complaining that the VM arguments are too long, which is how properties in mule-app.properties are applied.
The way you can work-around it is to store your properties in a separate .properties file in src/main/resources and include this file as a property placeholder in your global configuration:
<context:property-placeholder location="myApp.properties"/>
Note if you use environment specific properties like this also you can reference multiple files separated with a comma, e.g.
<context:property-placeholder location="myApp.properties, ${mule.environment}.properties" />

Infinispan Configurations Using property file

Is it possible to load values for infinispan-config.xml file from some property file so that we can get rid of hard coded values. If possible then can somebody show me the way how i load property file in infinispan-config.xml file because there is no Pre defined tag for configuration.
This is possible by setting respective system properties.
For example here is one specific Infinispan configuration file which is using this approach: https://github.com/infinispan/infinispan/blob/master/core/src/test/resources/configs/string-property-replaced.xml
and here is a test which is working with that file: https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java
This looks to be the most straightforward way how to achieve this.
The last thing which needs to be done is to simply read all lines in your configuration file and put them correctly to system properties.

Can't get ApacheDS to load the example data file

In ApacheDS, I'm trying to load the sample LDAP data provided in ldif format and with instructions here.
I followed the same pattern I used to load the context record by specifying an ldif file in server.xml for the partition (directions, albiet lousy ones, located here).
So I have...
<apacheDS id="apacheDS">
<ldapServer>#ldapServer</ldapServer>
<ldifDirectory>sevenSeasRoot.ldif</ldifDirectory>
<ldifDirectory>apache_ds_tutorial.ldif</ldifDirectory>
</apacheDS>
The sevenSeasRoot.ldif file seems to have loaded properly, because I can see an entry for it in LdapBrowser. But there are no records under it.
What am I doing wrong? How do I configure server.xml to load the child records for sevenSeas?
Just a quick note, the config says ldif*Directory* but you are passing a file.
OTOH, I guess you are using 1.5.7 this is very old, it would be better to try the latest version for better support.

VB.NET: Changes to application.dll.config file does not reflect inside system

I'm quite new to this app.config function. Hope someone can show me the road on this.
I have a solution which comprise of 5 projects and one of them just to retrieve the value from the app.config file to be read by other projects. So, in the app.config file, i have my connection string stated inside and i can use it nicely.
After i built the projects, it will convert my app.config file to appname.dll.config file and it can be seen in the bin/Release folder. I copy all these projects bin/release content to another folder to have all those files stay in one place.
My question is, which config file should i change if i want to change the connection string username (for example) WIHOUT building the project and transfer again? I changed the value inside appname.dll.config file but it does not reflect when the program run. It's still taking the old connection string.
Hope someone can help me on this.
Thanks in advance.
Usually the app.config associated with the exe project (command line or GUI) is the one that holds the changes app wide. Check for the appname.exe.config file and make your necessary changes there for connection strings, etc...
[update]
Just thought of something else... if it's a web project you can use the web.config in the main webproject to configure your changes

How to read app.config from a custom location, i.e. from a database in .NET

I am trying to override the ApplyConfiguration method in my custom ServiceHost to read the configuration from a database instead of app.config. Ideally I would want to be able to do something like this:
Configuration config = GetConfigFromMyDatabase(...);
ServiceModelSectionGroup serviceModel = ServiceModelSectionGroup.GetSectionGroup(config);
Is there any way to do this without writing a temp app.config file?
What about using:
System.Configuration.ConfigurationManager.OpenExeConfiguration(string exePath)
That should let you open an arbitrary app.config file.
You do not need a separate AppDomain if you are writing a custom ServiceHost.
The ServiceHost has an ApplyConfiguration method that you can override. You can load config from wherever you like.
See here for a relevant article outlining the technique.
Despite you're not wanting to write the temp config file, the best way to do this is to host your service(s) in a separate AppDomain.
Before creating your AppDomain, grab the config from the database and write it to the file system, then when you create your AppDomain point it at the temp config file you retrieved from the database as it's config source.
Of course the config in the database would either have to be a full app.config file, or you'd have to merge it with some kind of template config file that had any other non-serviceModel configuration bits in it for the rest of your app.
Implementing it in this way is quite a neat solution, and works well (have used it before).