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:
Value | Verbose | Usage |
5 | Verbose |
Verbose is the noisiest level, rarely (if ever) enabled for a production app. |
4 | Debug |
Debug is used for internal system events that are not necessarily observable from the outside, but useful when determining how something happened. |
3 | Information |
Information events describe things happening in the system that correspond to its responsibilities and functions. Generally, these are the observable actions the system can perform. |
2 | Warning |
When service is degraded, endangered, or is behaving outside of its expected parameters, Warning level events are used. |
1 | Error |
When functionality is unavailable or expectations broken, an Error event is used. |
0 | Fatal |
The most critical level, Fatal events demand immediate attention. |
This is an optional property and if it is not set, the default value of 1 will be used.
How to use logging
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); |
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(); } |