Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow using with postgresql #1

Closed
mateusleonardi opened this issue Dec 28, 2016 · 6 comments
Closed

Stack overflow using with postgresql #1

mateusleonardi opened this issue Dec 28, 2016 · 6 comments
Assignees
Labels

Comments

@mateusleonardi
Copy link

Hello,

I'm trying to use this logging with postgresql but when the application starts I get the Stack Overflow Exception.

My entity framework is working fine with postgresql.

Do you know if is possible to use this tool with it?

Thanks in advance.

@msmolka
Copy link
Owner

msmolka commented Dec 28, 2016

There should not be any issue with postgress.

However there can be issue with global logging configuration. If you are not using any filters for this logger and adding it in the same way as AddDebug or AddConsole, you can have such problem, because EF Core is using logging internally, so it tries to use logger which depends on it.
Try add and use logging filters and exclude all Entity Framework Core logs from storing them in database.
See https://github.com/msmolka/ZNetCS.AspNetCore.Logging.EntityFrameworkCore/blob/master/test/ZNetCS.AspNetCore.Logging.EntityFrameworkCoreTest/StartupSimple.cs, as example.

In short you should exclude any EFC internal logging from being handled by this logger. Let me know if this filter works.

@msmolka
Copy link
Owner

msmolka commented Dec 29, 2016

If you still have issue with logger after exclude EF Core logs from logger please provide small example and I will try to analyse and solve.
I personally tested it with MySQL, MariaDB, SQL Server, InMemory databases and it worked.

@msmolka msmolka self-assigned this Dec 29, 2016
@mateusleonardi
Copy link
Author

It wasn't working anyway so I created my own logger.

Thank you for the attention.

@msmolka
Copy link
Owner

msmolka commented Dec 29, 2016

I was wonder what was wrong, in my opinion all should work. But ok, closing.

@msmolka msmolka closed this as completed Dec 29, 2016
@pdesterlich
Copy link

pdesterlich commented Feb 22, 2017

If anyone is interested, suggested solution from @msmolka works.

I had the same problems reported by @mateusleonardi with different databases (mariadb, sql server and sqlite), giving different errors but anyway not working (working fine where i removed database logging).

If i add a filter to ignore microsoft and system logs (and add "Microsoft.Extensions.Logging.Filter" to dependencies) everything works fine (both app and database logs)

edit: you can find a sample working project at https://github.com/pdesterlich/LoggingTest

@msmolka
Copy link
Owner

msmolka commented Feb 23, 2017

@pdesterlich thank for more testing and confirmation. I'm using this library on daily basis and the only issue is to make sure you are not logging (using this logger) anything related to Microsoft.EntityFrameworkCore.
This is because each log of EFCore will cause to log. So obviously Stack Overflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants