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

Log statements changed from debug to trace level #516

Merged
merged 20 commits into from
Jun 7, 2020

Conversation

nward1234
Copy link
Contributor

No description provided.

…ng is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.
…hanged the test method names in some cases to make the purpose of each test method more clear.
…hich I found useful to see in log statements.
…provides more evidence that the Pebble syntax is good. Jinja is a very popular Python template engine.
…l log statements in LexerImpl, PebbleEngine and LexerImpl that were useful to me when trying to follow the code. Added logback-test.xml to configure the logging level. Disabled the debug logging by default. Also removed Hamcrest Matchers and replaced references to Hamcrest in exception testing code with AssertJ. Also, changed the name of a few private methods in LexerImpl for improve clarity.
…statements were being output by default. Trace statements are not output unless configured to do so.
@ebussieres
Copy link
Member

Is there a reason to change these four lines to trace ?

@nward1234
Copy link
Contributor Author

Yes. The default log level for logback is DEBUG. When I use Pebble in my application that does not have an explicit log level specified (i.e. no logback.xml file), the DEBUG statements are produced. Therefore, this probably happens for other people as well.

This was not the case until the latest release of Pebble because I added these log statements last year when trying to understand the Pebble Lexer code. These statements are useful for that purpose, but TRACE would be a reasonable level for these statements. Also, I did use TRACE level in the LexerImpl code. So, this makes the log level consistent for these type of log statements.

Do you want me to submit an issue for this for records purposes?

Here's an example of the log statements. These should not be produced unless someone specifically configures logback to produce them.

11:31:52.266 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 8
11:31:52.270 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 6
11:31:52.270 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 3
11:31:52.270 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 4
11:31:52.270 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 2
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 1
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 6
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 6
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 8
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 1
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 3
11:31:52.271 [main] DEBUG com.mitchellbosecke.pebble.lexer.TemplateSource - Advancing amount: 4

@ebussieres ebussieres added this to the 3.1.5 milestone Jun 7, 2020
@ebussieres ebussieres merged commit ffd36f9 into PebbleTemplates:master Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants