My application uses Entity Framework Core, SQLite and Serilog to log to an SQLite database named Database.db. When Database.db reaches 10 MB Serilog creates a new database and renames the previous Database-someDate.db. I can't read from Database-someDate.db, only from Database.db.
How can I read from these files or force it to only use one file?
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var connectionString = ConfigurationManager.ConnectionStrings["SqliteConnectionString"].ConnectionString;
optionsBuilder.UseSqlite(connectionString);
}
<connectionStrings>
<clear/>
<add name ="SqliteConnectionString"
providerName="System.Data.Sqlite"
connectionString="Data Source= ./Database.Db"/>
</connectionStrings>
NuGet packages:
Serilog config:
<appSettings>
<!--serialog-->
<add key="general:serilog:minimum-level" value="Verbose"/>
<!--serilog sqlite-->
<add key="sqlite:serilog:using:SQLite" value="Serilog.Sinks.SQLite"/>
<add key="sqlite:serilog:write-to:SQLite.sqliteDbPath" value="Database.db"/>
<add key="sqlite:serilog:write-to:SQLite.tableName" value="Logs"/>
<add key="sqlite:serilog:write-to:SQLite.storeTimestampInUtc" value="false"/>
<add key="sqlite:serilog:write-to:SQLite.autoCreateSqlTable" value="true"/>
</appSettings>
found in repository I decided to increase the size of the database, focusing on the size of my application
In appSettings:
<!--serilog sqlite-->
<add key="sqlite:serilog:using:SQLite" value="Serilog.Sinks.SQLite"/>
<add key="sqlite:serilog:write-to:SQLite.sqliteDbPath" value="Database.db"/>
<add key="sqlite:serilog:write-to:SQLite.tableName" value="Logs"/>
<add key="sqlite:serilog:write-to:SQLite.storeTimestampInUtc" value="false"/>
<add key="sqlite:serilog:write-to:SQLite.autoCreateSqlTable" value="true"/>
<!--parameter responsible for the size of the database file (MB), maximum-10GB -->
<add key="sqlite:serilog:write-to:SQLite.maxDatabaseSize" value="2048"/>
<!--parameter responsible for the creating a new file-->
<add key="sqlite:serilog:write-to:SQLite.rollOver" value="true"/>