Quantcast
Channel: patterns & practices – Enterprise Library
Viewing all 1928 articles
Browse latest View live

New Post: EventLog Listener?


New Post: ExecuteSprocAccessor with Refcursor in EnterpriseLibrary 6.0 DAAB

$
0
0
I'm curious what data provider you are using for ODP.NET? Is it from EntlibContrib?

To give you an idea this is basically what the source code is doing:
AddParameter(command as OracleCommand, "CUR_OUT", OracleDbType.RefCursor, 0, ParameterDirection.Output, true, 0, 0, String.Empty, DataRowVersion.Default, Convert.DBNull);
What if you try this IParameterMapper?
publicclass OracleParameterMapper : IParameterMapper
    {
        readonly OracleDatabase database;
        public OracleParameterMapper(Database database)
        {
            this.database = database as OracleDatabase;
        }

        publicvoid AssignParameters(DbCommand command, object[] parameterValues)
        {
            if (parameterValues.Length > 0)
            {
                GuardParameterDiscoverySupported();
                database.AssignParameters(command, parameterValues);
            }

            if (CommandType.StoredProcedure == command.CommandType)
            {
                bool doesQueryProcedureNeedCursorParameter = true;

                foreach (OracleParameter parameter in command.Parameters)
                {
                    if (parameter.OracleType == OracleType.Cursor)
                    {
                        doesQueryProcedureNeedCursorParameter = false;
                    }
                }

                if (doesQueryProcedureNeedCursorParameter)
                {
                    database.AddParameter(command as OracleCommand, "CUR_OUT", OracleType.Cursor, 0, ParameterDirection.Output, true, 0, 0, String.Empty, DataRowVersion.Default, Convert.DBNull);
                }
            }
        }

        privatevoid GuardParameterDiscoverySupported()
        {
            if (!database.SupportsParemeterDiscovery)
            {
                thrownew InvalidOperationException(
                    "Parameter Discovery Not Supported");
            }
        }
    }
If that doesn't work then I think you will need to try a different approach: either modify the source code to add the ref cursor or alternately create a custom Accessor or custom OracleDatabase to add the ref cursor. Try to recreate the ExecuteReader/DataSet (since they work) logic for how the parameters (as well as the ref cursor parameter) are added for an accessor.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Policy and Interceptions with Unity

New Post: Different Log file for different sources

$
0
0
Thank you so much Randy! My bad since I didn't try changing the name. This fixed the issue.

Thanks,
Himanshu

New Post: Semantic Logging out-of-process logging error in EventViewer

$
0
0
Can you please let me know if this is a blocking issue, in the sense that no more messages would be logged until the service is restarted? Or is it something intermittent and can be ignored for a while? Restarting IIS would not be suitable on production sites. Please suggest.

Regards,
Himanshu

Created Unassigned: EntLib6: At times the Rolling Flat File Trace Listener won't consistenly roll to new log file [33769]

$
0
0
Have seen this happen a few times, where the rolling log file set to roll on a 'Day' basis doesn't roll and one log will contain entries across more than one day.

Don't know the cause or trigger of this. Sometimes it happens and sometimes it rolls.

Created Unassigned: EntLib6: Configuration editor v6 suddenly won't recognize database listeners [33770]

$
0
0
First noticed with opening a config file with loggingConfiguration the editor complained that the Microsoft.Enterprise.Logging.Database based trace listener was invalid.

Looks like it can't find this dll. Up until today didn't have any issues with this and used the configuration editor to setup logging.

Today attempted to open the file and now it can't find this dll anymore. Don't know causes.

Not sure where the configuration editor is located either, or even what the executable is called.

Commented Unassigned: EntLib6: Configuration editor v6 suddenly won't recognize database listeners [33770]

$
0
0
First noticed with opening a config file with loggingConfiguration the editor complained that the Microsoft.Enterprise.Logging.Database based trace listener was invalid.

Looks like it can't find this dll. Up until today didn't have any issues with this and used the configuration editor to setup logging.

Today attempted to open the file and now it can't find this dll anymore. Don't know causes.

Not sure where the configuration editor is located either, or even what the executable is called.
Comments: To be able to use it at all, found that upon right clicking a config file in Visual Studio, and choosing 'edit configuration file v6' that it will create a temp folder at C:\Users\username\AppData\Local\Temp\27ee3a7ef0c94ae489e3819c1e594ba6-v6 . Then close it, and copy over the two missing dlls into that folder, and run it again double-clicking the executable in that folder. So whatever mechanism is putting files into that temp directory for the entlib configuration editor isn't pulling over the Data or Logging.Database dlls. Up until today, it was.

New Post: Configure entlib after deployment

$
0
0
Hello all.

Not all configuration changes need program changes. For example changing the logging destination from eventlog to file or something like that.

I would love to see that I am not needed to configure every installation or tell my clients to learn the XML syntax. That creates too many errors or too much effort on my side.

Is there a front end like the one for Visual Studio which I could deploy with my application?

That way some events/messages could be handled differently by the clients. Some want to ignore some and some would like to have them logged in any way.

Kind regards
Bernd

Commented Unassigned: EntLib6: At times the Rolling Flat File Trace Listener won't consistenly roll to new log file [33769]

$
0
0
Have seen this happen a few times, where the rolling log file set to roll on a 'Day' basis doesn't roll and one log will contain entries across more than one day.

Don't know the cause or trigger of this. Sometimes it happens and sometimes it rolls.
Comments: `RollInterval.Day` will roll the file (at least) one day after the file was created. If you want the file to roll based on a calendar day then `RollInterval.Midnight` would be a better option.

New Post: Configure entlib after deployment

New Post: Semantic Logging out-of-process logging error in EventViewer

$
0
0
Can you please let me know if this is a blocking issue, in the sense that no more messages would be logged until the service is restarted?
What behavior are you seeing?

My guess is that the error occurs when a mismatch occurs between the messages and the (generated) manifest which could occur due to user error (passing incorrect arguments) or perhaps if changes are made to the event source (which may occur during development) it could cause issues. From the developer's guide:
The methods in your custom EventSourceclass will be called from multiple places in your
application, and possibly from multiple applications if you share the same EventSourceclass. You
should take care when you modify your EventSourceclass, that any changes you make do not have
unexpected consequences for your existing applications. If you do need to modify your EventSource
class, you should restrict your changes to adding methods to support new log messages, and adding
overloads of existing methods (that would have a new event ID). You should not delete or change
the signature of existing methods.

This is especially important in light of the fact that if you have multiple versions of your EventSource
class in multiple applications that are using the Semantic Logging Application Block out-of-process
approach, then the version of the event schema that the host service uses will not be predictable.
You should ensure that you have procedures in place to synchronize any changes to the EventSource
class across all of the applications that share it.
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Configure entlib after deployment

New Post: Error on setting up database logging ... invalid tracelistenerdata type in configuration

$
0
0
Found the issue with unit testing. When the unit test engine/runner pulled together the dlls, a couple of the enterprise logging library dlls didn't make it.

I found these attributes applied at the class level (set in the sample place as [TestClass] attribute), fixed the issue:
[DeploymentItem("Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll")]
[DeploymentItem("Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll")] 
Both of these dlls are named in such a way that the classes appear as if they could be in different dlls. For instance there is an Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll and Microsoft.Practices.EnterpriseLibrary.Logging.dll and the naming on those two are what the root cause seems to be, as the two dlls that must be pointed out as Deployment Items have extensions to those names, causing the confusion.

All the dlls here seem to be of such a size that they could be combined into just Logging and Exception handling, without needing a plethora of dlls to reference. It would make our lives easier.

New Post: why logging code need hold file handle

$
0
0
As EL Loggging replacement for more flexiable category managing, I am trying implement my own logging codes. And I have one concern that i don't understand why EL holds log file handler till application ends. Is it to solve some issue or to get better write performance?

New Post: EventSource.WriteEvent Method (Int32, Object[]) not working

$
0
0
Error: Unsupported type Object[] in event source

I cannot get this overload of the WriteEvent Method to work:
EventSource.WriteEvent Method (Int32, Object[])

According to this link, it should work: http://msdn.microsoft.com/en-us/library/hh393360.aspx

Here is the code I am using
public class Logger : EventSource
{
    public static readonly Logger Log = new Logger();

    [Event(101, Level = EventLevel.Informational]
    public void TestObjectParms(params object[] args)
    {
        if (IsEnabled()) WriteEvent(101, args);
     }
}
To invoke:
object[] testArgs = {"object1","object2","object3"};
Logger.Log.TestObjectParms(testArgs);
It compiles clean but the EventSourceAnalyzer returns this message:
"Error: Unsupported type Object[] in event source"

My other events all work fine. Any help would be appreciated.

New Post: EventSource.WriteEvent Method (Int32, Object[]) not working

$
0
0
Only certain parameter types are supported by the System.Diagnostics.Tracing.EventSource infrastructure as parameters for an EventSource Event method. As the error mentions Object[] is not one of these types. This constraint is on the Event method, TestObjectParms, and not related to WriteEvent . The link you referenced is for the internal EventSource.WriteEvent method which does take params.

This makes sense because Semantic logging is about structured data; the infrastructure interrogates the method signatures of the public EventSource methods (e.g. TestObjectParms) to create a manifest which describes the event metadata (e.g. parameter types, parameter order, OpCodes, etc.). The metadata is used in reading and writing the event data so that structure is maintained (among other things).

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: EventSource.WriteEvent Method (Int32, Object[]) not working

$
0
0
Ok, thank you. The internal EventSource.WriteEvent method is what was throwing me off.

New Post: why logging code need hold file handle

New Post: why logging code need hold file handle

$
0
0
Enterprise Library itself doesn't explicitly lock the file. The locking is done by the System.Diagnostics.TextWriterTraceListener which Enterprise Library extends. TextWriterTraceListener opens the file as FileShare.Read. Some reasons to do this would be for performance (avoid opening and closing the file constantly) and to avoid multiple processes writing interleaved output to the file.

This may be presumptuous since I have no idea about your specific scenario but, in general, I would recommend not writing your own logging framework in lieu of using one of the established logging frameworks.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Viewing all 1928 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>