This is a migrated thread and some comments may be shown as answers.

Tracing & logging, show column insert values

4 Answers 41 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 12 Jul 2014, 12:25 PM
Hi,

I have seen it before, but can't find it anywhere now. I've used this article:
http://docs.telerik.com/data-access/developers-guide/tracing-and-logging/data-access-tasks-tracing-and-logging-create-custom-trace-listener

But the SQL statements are shown with ? for the values. It should be possible to see the values, but how? Been looking for it this morning and yesterday...

Could you point me to the right direction?

Erik

Example:
I now get:
insert [App.Com].[ItemGroups] ([AutoNrFomat], [AutoNrNext], [Code], [Description], [IconId], [InternalTag], [ItemGroupDefinitionId], [ItemGroupStateId], [Name], [Number], [ParentItemGroupId], [SysAccountId], [SysAdminId], [SysDeleted], [SysTemplateId], [SysUniqueId]) 
output inserted.[ItemGroupId] into @generated_ids 
 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 


4 Answers, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 16 Jul 2014, 03:36 PM
Hello Erik,

If you want only to trace the SQL Statements generated by the context, I would recommend you to use another approach - to initialize the OpenAccessContext.Log property, instead of creating a CustomTraceListener. The Log property is of type TextWriter so you can initialize it with Console.Out with direct output to the console or with a StringWriter. Then the only additional step you should do is to set the Log Level to Verbose or All, then you would be able to see all of the parameters values.

I hope that helps.

Regards,
Boris Georgiev
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Jose
Top achievements
Rank 1
answered on 10 Aug 2015, 10:36 AM

Hi Boris, 

I have the same problem, no real values on variables, just host variables.

I have tried verbose ans all, with no change.

DataAcces version 2014.3.1209.1 

The code

Telerik.OpenAccess.BackendConfiguration telback =
                  new Telerik.OpenAccess.BackendConfiguration();
                telback.Logging.LogEvents = Telerik.OpenAccess.LoggingLevel.All;
                // em is my dbcontext
                em.Log = new StringWriter();
                StringWriter outsql = new StringWriter();
                em.Log = outsql;

     after save I have outsql as "... WHERE "id" = :p1 ..."

Thanks

Paulo

0
Boris Georgiev
Telerik team
answered on 13 Aug 2015, 10:13 AM
Hello Erik,

There are some things which I cannot understand: 
1) What type of model/mapping you are using? Fluent or Domain Model?
2) When you create BackendConfiguration object what you are doing with it? Do you change the context BackendConfiguration with the new one and how you change it?

The easiest way to change the log level, if you are using Fluent Model is to only add this line:
backend.Logging.LogEvents = LoggingLevel.All;
in FluentModel class, in method: public static BackendConfiguration GetBackendConfiguration()
 
If you are using Domain Model you could follow the steps described in this documentation article.

Also in this article you can find information how to change the Logging Configuration for any scenario.

I hope that helps. If you are trying to achieve something else, do not hesitate to contact us again.

Regards,
Boris Georgiev
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Jose
Top achievements
Rank 1
answered on 25 Aug 2015, 12:32 PM

Ok. Model. Fixed and running.

Thanks

Tags
Design Time (Visual Designer & Tools)
Asked by
Erik
Top achievements
Rank 2
Answers by
Boris Georgiev
Telerik team
Jose
Top achievements
Rank 1
Share this question
or