changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Too verbose logging on missing resources #479

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm reusing the same wro.xml configuration by several apps which may have 
different location/directory for the same files, so including all the variants 
of them and configured wro.properties to ignoreMissingResources=true

With this setting I wouldn't expect that much logging as I knowingly want to 
ignore missing resources (at least for now). So maximum that is expected is one 
(and only one, not 8) INFO logging line per missing resource that is missing 
(not WARN and of course not ERROR).

12:40:38,825  WARN DispatcherStreamLocator:92 - Wrong or empty resource with 
location: /gui-v2/loginStyles.css
12:40:38,826 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/gui-v2/loginStyles.css
12:40:38,826  WARN ServletContextUriLocator:172 - Wrong or empty resource with 
location: /gui-v2/loginStyles.css
12:40:38,827  WARN PreProcessorExecutor:226 - Invalid resource found: 
ro.isdc.wro.model.resource.Resource@339274f9[CSS,/gui-v2/loginStyles.css,true]
12:40:38,873  WARN DispatcherStreamLocator:92 - Wrong or empty resource with 
location: /gui-v2/loginStyles.css
12:40:38,874 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/gui-v2/loginStyles.css
12:40:38,874  WARN ServletContextUriLocator:172 - Wrong or empty resource with 
location: /gui-v2/loginStyles.css
12:40:38,875  WARN CssImportPreProcessor:142 - Invalid import detected: 
/gui-v2/loginStyles.css

Original issue reported on code.google.com by lystoc...@gmail.com on 4 Jul 2012 at 10:09

GoogleCodeExporter commented 9 years ago
There are more than one approach:
1) Always use DEBUG level (except the one from CssImportPreProcessor). 
2) Use DEBUG & WARN level based on value of ignoreMissingResource property.

Probably 2 is better..

Original comment by alex.obj...@gmail.com on 5 Jul 2012 at 7:33

GoogleCodeExporter commented 9 years ago
When ignoreMissingResource=false it will result in exception so probably 
logging with WARN is not needed (will be logged as ERROR).

Original comment by lystoc...@gmail.com on 6 Jul 2012 at 11:22

GoogleCodeExporter commented 9 years ago
Fixed in branch 1.4.x. 
After all, the option 1 was preferred: the DEBUG level is used in locators, 
since the exception is propagated anyway and ERROR level is used where the 
ignoreMissingResource property is checked.

Original comment by alex.obj...@gmail.com on 8 Jul 2012 at 10:32

GoogleCodeExporter commented 9 years ago
I've tried this on branch issue482 and see:

10:32:14,739 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/gui-v2/styles.css
10:32:14,748 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/gui-v2/styles.css
10:32:16,751 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/assets/stylesheets/application.css
10:32:16,771 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/assets/stylesheets/application.css

/gui-v2/styles.css and /assets/stylesheets/application.css (from issue482) 
resources do not exist in this context 
but I have ignoreMissingResources=true
so I don't like seeing any ERRORS (with [FAIL]). INFO is max logging level that 
is acceptable here I think, but DEBUG would be more appropriate.

Original comment by lystoc...@gmail.com on 9 Jul 2012 at 8:00

GoogleCodeExporter commented 9 years ago
I would like to reopen this one as with version 1.4.8 and

resourceWatcherUpdatePeriod=1
ignoreMissingResources=true

I get lots of noise in logs every second:

INFO ResourceWatcherRunnable:66 - ResourceWatcher started...
WARN ResourceWatcherRunnable:127 - Cannot check 
ro.isdc.wro.model.resource.Resource@1984e990[CSS,/some.css,true] resource 
(Exception message: Exception while reading resource from /some.css). Assuming 
it is unchanged...
WARN ResourceWatcherRunnable:127 - Cannot check 
ro.isdc.wro.model.resource.Resource@55456c99[CSS,/someother.css,true] resource 
(Exception message: Exception while reading resource from /someother.css). 
Assuming it is unchanged...

Those warnings are useless in case when we do ignore missing resources:
ignoreMissingResources=true

and maybe useful if not.

Pertaining 
INFO ResourceWatcherRunnable:66 - ResourceWatcher started...
it is just spammy (every sec) so maybe better to use DEBUG here?

Optional, but it would be nice when:
ignoreMissingResources=false
those warn messages were logged only once when the state changed e.g. some new 
resources become missing.
That would require to keep that state somewhere in cache.

Original comment by lystoc...@gmail.com on 10 Aug 2012 at 9:12

GoogleCodeExporter commented 9 years ago
I would rather open a new issue, since it concerns a different part of the 
code. This also simplify the tracking.

Regarding your mentions:
- Set the resourceWatcherUpdatePeriod to something like 10 (seconds). 1 second 
is too often.
- ResourceWatcher is intended to be used in development, so it worth knowing 
that something is happening in the background. But I'm open to change this if 
you don't agree.
- Warn about missing resources when ignoreMissingResources is set to true, does 
make sense. Will fix that.
- When a resource has changed, the change is reported in the logs the same way 
the missing resource is reported. The state is kept in a map inside the 
ResourceWatcher. I'm not really sure what do you mean by your last suggestion.

Original comment by alex.obj...@gmail.com on 10 Aug 2012 at 9:21

GoogleCodeExporter commented 9 years ago
Moved to issue #512.

Original comment by lystoc...@gmail.com on 11 Aug 2012 at 12:09