DataConnector | ComponentOne
In This Topic
    Logging
    In This Topic

    A log file is a textual data file that stores events, processes, messages, and other data.

    Log files may be useful for capturing unsuccessful attempts, failed user authentication, or unexpected server overloads. They can help identify slow queries, errors that are causing transactions to take too long or bugs that impact service performance. To be able to capture provider logging, it is necessary to add these properties in the connection string:

    How to use logging

    1. Create a connection string to set up a connection to a provider by setting the following Logging properties.
      Copy Code
      string connectionString = string.Format(@"Log File={0};Verbosity Level={1};Log File Count ={2};Log File Size={3},
             "C:\user_system_path\Json.log", 3, 2, 1000000);
    2. Fetch data using DataConnectors. The following example implements data retrieval using ADO.NET provider for JSON.
      Copy Code
      string connectionString = string.Format(@"Data Model={0};Uri={1};Json Path={2};Use Pool=true;Log File={3};
             Verbosity Level={4};Log File Count ={5}","Document", "test json array.json", "$", "C:\user_system_path\Json.log", 3, 2);
      
      using (var con = new C1JsonConnection(connectionString))
      {
          con.Open();
          var cmd = con.CreateCommand();
          cmd.CommandText = "select * from [test json array]";
          var reader = cmd.ExecuteReader(); 
      }