Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GenericEnumMapper is a bit too chatty on the logs for me #563

Answered by hazzik
razzmatazz asked this question in Q&A
Discussion options

Hi and thanks for the awesome lib!

One issue I have is GenericEnumMapper<> (or related code) is that it is emitting quite a lot of debug messages when it performs conversions string -> enum (and presumably back). This makes reading system logs a bit cumbersome.

For example (with assembly, enum and table names replaced to protect the innocent):

DEBUG FluentNHibernate.Mapping.GenericEnumMapper`1[[(assembly)]], returning null as column: table10_68_0_
DEBUG FluentNHibernate.Mapping.GenericEnumMapper`1[[(assembly)]], binding 'EnumValue' to parameter: 8
DEBUG FluentNHibernate.Mapping.GenericEnumMapper`1[[(assembly)]], returning 'EnumValue' as column: table10_68_1_

The mapping is

Map(x => x.EnumProp, "enum_column").Nullable().Length(64).CustomType<GenericEnumMapper<MyEnum>>();

Maybe the mapping is not how it should look for mapping an enum value to string on DB?

However I could not find the code that does this in the repo that does this logging with simple greps. Maybe it is in some dependency or NHibernate itself? If you could point me to the place I could make a PR then.

Is there a way to tune down the volume of the log messages? I guess one way would be to configure logging system to match on GenericEnumMapper, but maybe it would be good for the default behaviour to be a little bit more quiet?

You must be logged in to vote

However I could not find the code that does this in the repo that does this logging with simple greps.
Maybe it is in some dependency or NHibernate itself?

Yes, it is in NHibernate. The code is here:

Replies: 1 comment

Comment options

However I could not find the code that does this in the repo that does this logging with simple greps.
Maybe it is in some dependency or NHibernate itself?

Yes, it is in NHibernate. The code is here:

Is there a way to tune down the volume of the log messages?

Yes, you should be able to disable debug logging for this logger. Use "NHibernate.Type" logger to do so. (The exact code depends on a logging provider you use).

PS: you should not use debug logging in production.

You must be logged in to vote
0 replies
Answer selected by hazzik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #493 on October 12, 2022 22:23.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.