Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Question regarding adding log type in DNN6Question regarding adding log type in DNN6
Previous
 
Next
New Post
7/29/2011 11:53 AM
 
Hi,

I'm working on some new functionality with some custom modules referencing the DNN 6 dll.  My suite of custom modules add custom log types dynamically if they don't already exist.

This worked in DNN 5x:

                    Dim lc As New DotNetNuke.Services.Log.EventLog.LogController()
                    Dim lti As New DotNetNuke.Services.Log.EventLog.LogTypeInfo()
                    lti.LogTypeCSSClass = logTypeCSSClass
                    lti.LogTypeDescription = logTypeDescription
                    lti.LogTypeFriendlyName = logTypeFriendlyName
                    lti.LogTypeOwner = "DotNetNuke.Logging.EventLogType"
                    lti.LogTypeKey = logTypeKey
                    lc.AddLogType(lti)
                    Dim ltci As New DotNetNuke.Services.Log.EventLog.LogTypeConfigInfo()

                    ltci.LogTypeKey = logTypeKey
                    ltci.LoggingIsActive = True
                    ltci.MailFromAddress = ""
                    ltci.MailToAddress = ""
                    ltci.EmailNotificationIsActive = False
                    lc.AddLogTypeConfigInfo(ltci)


In DNN 6, I get an error on the last line of the code above.

Message: System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.IsMatch(String input) at DotNetNuke.Services.Log.EventLog.DBLoggingProvider.DBLoggingProvider.AddLogTypeConfigInfo(String id, Boolean loggingIsActive, String logTypeKey, String logTypePortalID, String keepMostRecent, String logFileName, Boolean emailNotificationIsActive, String threshold, String thresholdTime, String thresholdTimeType, String mailFromAddress, String mailToAddress) at DotNetNuke.Services.Log.EventLog.LogController.AddLogTypeConfigInfo(LogTypeConfigInfo logTypeConfig) at SunsetHill.VRS.Utilities.CreateLogType(String logTypeKey, String logTypeFriendlyName, String logTypeDescription, String logTypeCSSClass) in C:\DevPortals\VRS110DNN6\DesktopModules\SunsetHill\VRS\CoreClasses\Utilities.vb:line 157

*******************

Please have a look at the screenshot with the info - any assistance would be appreciated.  There doesn't appear to be any changes to the structure of the EventLogConfig table ... I'm stumped...

Screenshot...








 
New Post
7/29/2011 12:46 PM
 
If you take a look at the code for AddLogTypeConfigInfo(), you'll see that there are 3 properties that are converted to strings, see lines 10, 11 and 12 below. In the sample code you posted, you are not initializing these properties and they have no default values established in the Info class, so when you pass the Info object to AddLogTypeConfigInfo(), the lines which attempt to convert the null values to strings are throwing the exception you are seeing.  So just set those 3 properties in your ltci object before calling the controller add method.


   1:  public virtual void AddLogTypeConfigInfo(LogTypeConfigInfo logTypeConfig)
   2:  {
   3:      LoggingProvider.Instance().AddLogTypeConfigInfo(logTypeConfig.ID,
   4:              logTypeConfig.LoggingIsActive,
   5:              logTypeConfig.LogTypeKey,
   6:              logTypeConfig.LogTypePortalID,
   7:              logTypeConfig.KeepMostRecent,
   8:              logTypeConfig.LogFileName,
   9:              logTypeConfig.EmailNotificationIsActive,
  10:              Convert.ToString(logTypeConfig.NotificationThreshold),
  11:              Convert.ToString(logTypeConfig.NotificationThresholdTime),
  12:              Convert.ToString(logTypeConfig.NotificationThresholdTimeType),
  13:              logTypeConfig.MailFromAddress,
  14:              logTypeConfig.MailToAddress);
  15:  }
 
New Post
7/30/2011 7:08 AM
 
Thanks for your help.  I've got it working now.

Al
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Question regarding adding log type in DNN6Question regarding adding log type in DNN6


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out