Ticket Q418093
Visible to All Users

Logging in the Application Server

created 13 years ago

Hello. When I create a SimpleTextLogWriter I get a messages like this:
Operation CommitObjects was completed successfully.
UserId: 1c15beaa-5db6-4f22-8bed-6e386b51a313. UserName Admin.
Operation Result: DevExpress.Xpo.CommitObjectStubsResult[]
ClientId: '00'; WorkspaceId: '00'; LogonParameters: 'DevExpress.ExpressApp.Security.AuthenticationStandardLogonParameters'
but I need to know which field in db was changed. Is it possible?

Answers

created 13 years ago (modified 13 years ago)

Thank you for your feedback.
Currently, we don't have a ready documentation regarding this task.
The How to: Enable Logging in the Application Server topic describes how to write formed strings to a specific storage.
For your task each passed string should be extended so this approach doesn't suit your needs. We have introduced the SecuredSerializableObjectLayerLogger class to implement the default logging. This class implements the ISecuredSerializableObjectLayer interface and wraps a real SecuredSerializableObjectLayer object:

Code
public SecuredDataServer(IDataLayer dataLayer, QueryRequestSecurityStrategyHandler querySecurityEnvironmentHandler, ILogger logger, EventHandler<DataServiceOperationEventArgs> committingDelegate) { RequestSecurityStrategyProvider securityStrategyProvider = new RequestSecurityStrategyProvider(dataLayer, querySecurityEnvironmentHandler); IServerSecurity serverSecurity = CreateDefaultServerSecurity(securityStrategyProvider); ISecuredSerializableObjectLayer objectLayer = CreateDefaultSecuredSerializableObjectLayer(dataLayer, securityStrategyProvider, committingDelegate); if(logger != null) { serverSecurity = new ServerSecurityLogger(serverSecurity, logger); objectLayer = new SecuredSerializableObjectLayerLogger(objectLayer, logger); } Initialize(serverSecurity, objectLayer); }

Currently, the SecuredDataServer class is not designed to change this behavior with the help of events. Introduce your own CustomSecuredDataServer class and pass your CustomSecuredSerializableObjectLayerLogger object to the Initialize method.
We will see how to improve our documentation and describe the current behavior in a more precise manner.
Please clarify your task in grater detail if this information doesn't help you implement the necessary behavior.

    Comments (3)
    ET ET
    Eugene Titarchuk 13 years ago

      Thank you for your answer. I try to write like this:
      class MySecuredDataServer : SecuredDataServer
          {
              public MySecuredDataServer(IDataLayer dataLayer, QueryRequestSecurityStrategyHandler
                                                                 querySecurityEnvironmentHandler, ILogger logger,
                                                                 EventHandler<DataServiceOperationEventArgs> committingDelegate) :
              base(dataLayer, querySecurityEnvironmentHandler, logger, committingDelegate)
              {
                  var securityStrategyProvider = new RequestSecurityStrategyProvider(dataLayer, querySecurityEnvironmentHandler);
                  var serverSecurity = CreateDefaultServerSecurity(securityStrategyProvider);
                  var objectLayer = CreateDefaultSecuredSerializableObjectLayer(dataLayer, securityStrategyProvider, committingDelegate);

      if (logger != null)
                  {
                      serverSecurity = new ServerSecurityLogger(serverSecurity, logger);
                      objectLayer = new SecuredSerializableObjectLayerLogger(objectLayer, logger);
                  }

      Initialize(serverSecurity, objectLayer);
              }
          }
      but Initialize method is private and I cann't use it.
      I am using standart SecuredDataServer class:
              var dataServer = new SecuredDataServer(Session.DataLayer, securityProviderHandler, logger, MyCommitHandler);
              …
      }
      private static void MyCommitHandler(object sender, DataServiceOperationEventArgs e)
      {
                var objects = e.ObjectSpace.ModifiedObjects;
      }
      It works, but problem is that my MyCommitHandler method does not contains information about user that perform this changes.

      Anatol (DevExpress) 13 years ago

        I apologize for the delay. We are overloaded with support queries. We will answer you as soon as we can.

        DevExpress Support Team 13 years ago

          Thanks for your update.
          I have extended the SecuredDataServer class to provide the capability to substitute the standard logging objects with custom objects.
          The Initialize method of the SecuredDataServer class is not designed to be used in descendants. Instead, the ServerSecurity and ObjectLayer objects should be created and configured manually and passed to the 'SecuredDataServer(IServerSecurity serverSecurity, ISecuredSerializableObjectLayer securedSerializableObjectLayer)' constructor. I have incorrectly advised this approach. I apologize for this inconvenience.
          Access the SecuritySystem.CurrentUser property to obtain an object that represents the current user. A value of this property is thread specific and initialized before each method is executed.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.