Subtopic: QUICKLY Get log4net Setup.

January 22nd, 2008 § 3 comments § permalink

(This is a subtopic of the Learning NHibernate by Example (Small).)

It took me a while to get used to log4net version 1.2.10. Here’s my attempt at a quick crash course on what I consider the basics of log4net.

Step 1: Download and reference it, derrr.

Step 2: Create a log4net.config file. I put mine in the OrderSystem.UI section, in the same location as the app.config of the startup application.

Here is mine, for now:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<log4net debug=”false”>

<!– Console Appender declaration –>
<appender name=”ConsoleAppender” type=”log4net.Appender.ConsoleAppender” >
<layout type=”log4net.Layout.PatternLayout”>
<param name=”ConversionPattern” value=”%-5p : %m%n” />
</layout>
</appender>

<!– Default configuration–>
<root>
<level value=”INFO” />
<appender-ref ref=”ConsoleAppender” />
</root>

<!– Overriden configuration by class name –>
<category name=”NHibernate”>
<level value=”Error” />
</category>
<category name=”OrderSystem.UI”>
<level value=”ALL” />
</category>
<category name=”OrderSystem.DataAccessLayer”>
<level value=”ALL” />
</category>
<category name=”OrderSystem.Objects”>
<level value=”ALL” />
</category>

</log4net>

Step 3: Pickup the log4net.config file. I added this to the bottom of my OrderSystem.UI’s AssemblyInfo.cs file.

[assembly: log4net.Config.XmlConfigurator(ConfigFile = “log4net.config”, Watch = true)]

Step 4: In any class – Import the namespace.

using log4net;

Step 5: In any class – Get the logger instance.

private static readonly ILog log = LogManager.GetLogger(typeof (Program));

Step 6: In any class – Use it.

log.Info(summary);

VOILA, now you can configure logging with an external configuration file.

Learning NHibernate by Example (Small).

January 18th, 2008 § 3 comments § permalink

So I started a new project a couple weeks back and I’m going to put off separating the common features into a “CommonProject” until later. I’ve run into a few tedious steps over and over again, that I already knew NHibernate would help me resolve quickly and easily. Once this is complete, I’ll take a look to see what needs to be done.

I like what I see already in NHibernate; I’m just not too happy about support for NHibernate.org and their community, or lack thereof. I downloaded a sample, but it’s not using the most up-to-date version, which is currently 1.2.1GA. I have a working version of it. If you want it, let me know.

(By the way, does anyone know what the “GA” in 1.2.1GA means?)

My environment:
Microsoft SQL 2005
Microsoft Visual Studio 2005 (ReSharper 3.0.2)
NHibernate 1.2.1GA

Dreamhost Rocks.

January 17th, 2008 § 0 comments § permalink

Although I was one of the few who got affected by this little accounting problem, I still really respect Dreamhost. Not only did the blog an apology and email me an apology, they even explained why this occurred and their solution to it. Honesty is the best policy.

I even learned something from them:
The moral of this story is that “flexibility” is rarely desired in programming! The less a program will accept/the less a program will do/the less options and preferences it has, the more usable it is/the more understandable it is/the more stable it is.

It’s too detailed to be made up, I guess. Anyway, my account is fixed and I’m still keeping my hosting with them.

GAIM + Synergy = BOOM.

January 6th, 2008 § 0 comments § permalink

Anyone else run into this issue? I have both up and running just fine for about an hour. Just a while ago, I moved my mouse to the other (client) machine, tried to go back to the (server) desktop, and everything freezes on the desktop.

I tried to remote desktop in, but the whole screen is frozen, BOO.

Multiple Projects, Similar Functionality.

January 4th, 2008 § 1 comment § permalink

I started a project more than a month back using Subversion, NUnit, and Trac. Here’s the problem now: I have a new project that does almost the same thing. They’re totally different projects and have no dependencies on each other. There’s just a set of code that could be reused by the new project.

How should I handle the source code?
1. I could just keep them separate and that’s no problem at all.
2. I could branch off and start a parallel project within the current repository.
3. Something else?

I haven’t had experience with this situation and need some suggestions.

Where am I?

You are currently viewing the archives for January, 2008 at thomas nguyen.