Gunnar Morling commented on Improvement HV-763

This is based on the discussion at the pull request for HV-754.

Hardy:

I think it is more a general thing I am wondering about. I noticed that we pass non strings at other places as well. This behavior is not really as deterministic than building a dedicated string upfront. I guess Member is not a big problem, but we pass for example as well ExecutableElement, which toString can change and is maybe to descriptive for a simple error message. Also we are passing Class objects which leads to a toString of "class com.acme.Foo" instead of the simple class name.
For this reason I was wondering whether we should not be more careful and only pass strings into the Log class (under the assumption that these strings are properly created).
Maybe we should investigate this later. I am fine with how it is now. Just wanted to explain my reasoning.

Gunnar:

I totally see where you're coming from and I also stumbled upon the class name issue you describe.

The type-safety fan I am, I still like the typed logging methods, since they avoid calling them with wrong parameters and also spare the caller from creating string representations. It also makes sure that objects of one type are always printed out in the same form (e.g. either the qualified or simple name for classes).

Maybe one could have an approach where one registers some sort of converter with the Log class, which then are used to create string representations of passed objects. I guess it shouldn't be too hard to add something like this to the logging tools.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira