Tuesday, May 10, 2011

Remote Log4Net

You probably know this already, or this might not come as a surprise but enabling log4net to log to a remote place is really simple.

We had a scenario of only one front end with custom systems using log4net, but we needed to add a second front end, and with that the question about what to do about logging.

I wasn't aware how simple is to enable remote logging on log4net. So, heads up if you were like me:

Get log4net Remove Logging Service at CodePlex (you can get the source and change at your will), after install this will create a listener service where you want to store your remote log repository.

Then, at your local clients just change the appender to something like this

<appender name="remotAppend" type="log4net.Appender.RemotingAppender" >
<sink value="tcp://remoteserver:port/Log4netRemotingServerService" />
<lossy value="false" />
<bufferSize value="10" />
<onlyFixPartialEventData value="true" />
</appender>

At your Remote repository use your favorite appender, RollingLogFileAppender or whatever.
Remember to add the hostname property to your layout type: (%-10property{log4net:HostName}).

Something like this:

<appender name="RollLogAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\LOGS\MYAPP.log.txt" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<encoding value="UTF-8" />
<datePattern value="'.'yyyy'.'MM'.'dd'.'HH'.log.txt'" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date (%-10property{log4net:HostName}) [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>

Maybe you could do without this Codeplex service, but since it was so simple and the component is working fine I didnt waste any time looking for alternatives.

If you dont agree, please comment, shed some light :) Thank you.

Thursday, July 29, 2010

IE8 Life Saver Tip

If you usually access say SharePoint (or any other site) with several users at the same time, for testing, admin, regular user, etc., you may found that IE8 doesnt allow you since every Window will share only one credential. With IE7 everything worked fine, it seems its a new 'feature'.

Well, the solution is pretty simple, File -> New Session, or else you can add "-nomerge" in your local IE shortcut.


Tuesday, April 20, 2010

Files missing in SharePoint? Even from RecycleBin and (god forbids) AllUserData?

If files are disappearing from your SharePoint Document Library and you are (probably) using some custom code on SharePoint Doc Libs then check if you have any SPFile.Delete() call because if so, that row will disappear from SharePoint for ever...Unless you have you Backup/Restore working on.

Developers should be aware that there is another method, .Recycle() that will send the file to the RecycleBin, and this is safer in most cases. Of couse if RecycleBin is disabled this method doesn't add any value i guess...

There are other cases that will delete the file for ever like sp workflow deletions but im not aware of more...probably those that internally use Delete().

There are some nice posts with more info on this @ sharemypoint, and its also good to read the SPFile documentation ;)

Tuesday, January 12, 2010

A new challenge(company) for 2010!

Thats right, I'm starting 2010 at a new company, ANCP. I have great memories from my former company, DevScope, and i will always remeber it has a great place to work, always at the tip of the edge adopting new technologies, young and smart people working on new stuff that most people on the country haven't heard about, even those working on IT.

I just want to say thanks to everyone at DevScope, specially Luis Martins for the opportunity and Marco Silva with who i have been working more regularly in the past year ;)

Now I will be focusing on SharePoint, and start to learn a BPM tool for SharePoint, but because i have moved to a non-IT company i will be giving support to other stuff as well. It's a different point of view that, I hope, will give me a different perspective to my work and insight to the business. Also because it's a government agency i might not be exposing everything i will be doing, still, expect some more SharePoint stuff, and more. Wish me luck @ ANCP.

Thursday, December 3, 2009

Language "pt-PT" does not exist in this MessageManager instance

Hi,

We were having some problems with the Variation site of a Commerce 2009 Contemporary Site. It seems when errors happen the message doesnt get translated. These things happen for example when searching and presenting orders in Order History. In the root or en-US site they work ok. In MOSS logs we didnt find much information.

We have most of the functionality working on the pt variation but these 'errors' were stoping us from advancing.

We get something like this in event log:
Pipeline Error: Component Execution failed for component[0x9] hr: 0x1B5AA390 ProgID: Commerce.OrderDiscount.1 Language "pt-PT" does not exist in this MessageManager instance. And something like this: An exception of type 'System.Runtime.InteropServices.COMException' occurred and was caught.
-------------------------------------------------------------------------------------------
12/02/2009 15:19:14 Type : System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Component Execution failed for component[0x9] hr: 0x1B5AA390 ProgID: Commerce.OrderDiscount.1 Language "pt-PT" does not exist in this MessageManager instance. Source : Commerce.MtsPipeline

We solved it by creating a MessageManager Resource dll, all info here: http://msdn.microsoft.com/en-us/library/ms964360(CS.70).aspx

You can find rc.xml in commerce sdk, RCxml2resx in commerce tools, resgen and al in visual studio command prompt.

We lost some time with this, and this solved almost all our problems, it should be documented in the variations paper ;)

Wednesday, November 18, 2009

Commerce Server 2009 + Windows 2008 R2 + Alias

If you get a strange error running Sharepoint Comerce Server Wizard at unpacking or having problems running PUP.exe and have an ALIAS configured for Sql, try adding the alias to the hosts file. This solved some problems. It seems PUP.exe uses named pipes to access Sql, go figure..

An error has occurred (80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.



Thursday, November 12, 2009

.NET 3.5 SP1 missing when installing Commerce Server 2009 on Win 2008 R2

When you try to install Commerce Server 2009 (after the 2007 install) on a Windows Server 2008 R2 you will get an error saying to install .NET 3.5 SP1.

You may try to install it, but you cant, when you try to install it extracts and the installer vanishes...you know why? R2 already comes with 3.5 SP1 (a warning on the installer saying its already installed would give us a better clue)

After some poking around we found a MS hot fix...a reg key is missing on the 3.5 SP1 of the R2.


Please stay around for more CS2009 info and also check my colleague Marco's Silva blog, for it will have soon more CS2009 goddies ;)