Показать сообщение отдельно
Старый 04.11.2011, 10:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
Axilicious:Propagate infolog messages to the windows event log
Источник: http://www.ksaelen.be/wordpress/2011...ows-event-log/
==============

The windows event viewer can be a nice tool to check for messages dispatched by the system. You can save the logs in there, reopen them, different kinds of information is available so you can actually trace lots of things in there. But wouldn’t it be nice to also be able to log the messages thrown by Ax 2012 in the windows event log?

That way you do not lose user messages and they are nicely logged into the event viewer. It can also help to log messages received on a client that you cannot seem to reproduce, …

Well, it is possible and here is how to do it in a couple of steps:

  • Add a windows event log and source to put our specific infolog messages in
  • Edit the Ax32 config file to add an event log listener to the configuration
Create event log and source

So first things first, let’s create a windows event log by using the following powershell command

new-eventlog -logname "RealDolmen Ax Solutions" -source "Ax 2012 Infolog"

The result should be like in the figure below



Configure the listener

To add a listener, first open the ax32.exe.config file located in the client\bin directory. You should see a configuration similar to this:

</span span style="color: #000066;"version/span=span style="color: #ff0000;""1.0"/span span style="color: #000066;"encoding/span=span style="color: #ff0000;""utf-8"/span span style="color: #000000; font-weight: bold;"?> </span> </span> </span> </span> </span> </span>

Modify the configuration so that it looks like this: (It is absolutely important to keep the source name !! The initializeData must be filled with the source you created in the event log)

</span span style="color: #000066;"version/span=span style="color: #ff0000;""1.0"/span span style="color: #000066;"encoding/span=span style="color: #ff0000;""utf-8"/span span style="color: #000000; font-weight: bold;"?> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span>

Now we are all set up and when firing up the client, any messages to the infolog should be redirected to the event log. So let’s send some error lines to the infolog.



Now check if the same messages appear in the infolog. Normally this is what it should look like:



So there you have it. The messages are nicely logged in the event viewer. As a last remark, you can also adjust the logging level by modifying the switchvalue of the source. Off will not log anything at all, verbose will fill your event log with everything.




Источник: http://www.ksaelen.be/wordpress/2011...ows-event-log/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.