How to fix error logging for item aliases using Sitecore?
alias, log4net, logging, sitecore, sitecore6
Solution
Maras is spot on, but you should be able to achieve this without the HttpProcessor, by "just" fiddling a bit with the log4net settings in web.config. I unfortunately don't have the time to fully test this answer for you, but I will point you in the direction I think you should be looking.
Find the `<log4net>` section in web.config. It defines a series of "appenders" that each are responsible for creating different logfiles in your Sitecore solution. They look like this:
<appender name="LogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/log.{date}.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" />
</layout>
</appender>
You can create your own appender; e.g. "AliasLogFileAppender" and have it logging it's content to something like `<file value="$(dataFolder)/logs/Aliaslog.{date}.txt" />`.
Once that is defined, all you need to do is wire it up to the namespace of Sitecore's own Alias Resolver in the httpRequestPipeline. Look just below the appenders, for the `<logger>` definitions. They look like this:
<logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
<level value="INFO" />
<appender-ref ref="WebDAVLogFileAppender" />
</logger>
The "name" attribute actually denotes the namespace, that will trigger the logger.
So your configuration should look something like:
<logger name="Sitecore.Pipelines.HttpRequest.AliasResolver" additivity="false">
<level value="INFO" />
<appender-ref ref="AliasLogFileAppender" />
</logger>
Again, apologies for not being able to test this prior to posting. I don't see why it wouldn't work however.
I do believe there is a way in log4net to re-map a certain error message from WARN to INFO as well. Details escape me at this minute however.
Problem
I'm using Sitecore 6.5. There is a multi-language configuration. I use items with aliases. Aliases can be created on a content item. Click on the item > Presentation > Aliases. Enter for example: /page/stackoverflow/myitem. Click OK. The alias is created in the content tree now, see: /sitecore/system/Aliases/* The alias is stored in the content tree as: ``` - page -- stackoverflow --- myitem ``` Each item is a part of the alias created. Problem. - Website url: http://www.contoso.local - Valid alias url: http://www.contoso.local/page/stackoverflow/myitem - Invalid alias url: http://www.contoso.local/page OR http://www.contoso.local/page/stackoverflow The invalid urls (based on the created alias) cause errors in the errorlog. 51161 12:01:26 ERROR An alias for "/page" exists, but points to a non-existing item. I want to change the: - Log level to `INFO/WARN` or - Log this error in a seperate errorlog or - Create a custom `httpRequest` pipeline to avoid this error. The above list is on the preferred order. Unless there are better possibilities to solve this problem. Is there anyone who have experienced this problem and have a good solution? Thanks a lot. Jordy