Logging informational messages from a controller or service is the sort of thing I wish I'd figured out how to do when I first started playing around with Grails. All the information is in the docs, but it took me a while to find it and it could be a bit obscure for someone just getting started.
Here's all you have to do:
1. Open
Config.groovy and find the log4j block.
2. At the bottom, add a line like this:
info 'grails.app'
3. In your controller action, wherever you want to log something, just add a line something like this:
log.info "In myController, my Action myVar is: ${myVar}"
Reference Link:
http://dowdrake.com/showthread.php?86-Grails-Logging-from-a-Controller-or-Service
分享到:
相关推荐
Grails Web 应用框架:grails-core
grails-1.0 中文参考文档 网上收集而来,对 e 文不太熟悉的朋友可以参考一下,有些翻译的不好理解,最好对照着官方的e 文的参考文档
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part1 共两个压缩包,解压后将扩展名.zip.bak改为.zip再次解压。
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part2 共两个包,解压后需要将扩展名.zip.bak改名为.zip重新解压。 http://dist.springsource.com/release/STS/3.8.1.RELEASE/dist/ e4.6/spring-tool-...
Groovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.ppt
elasticsearch-grails-plugin, 恢复的ElasticSearch grails插件 Elasticsearch插件插件这个项目是一个基于Elasticsearch的插件,这个项目是基于的人完成的伟大工作的。你为什么想要为原来的Elasticsearch插件提供...
Grails-2.4.4-用户手册
grails核心源码,版本2.2.2,可以给对grails开发感兴趣的朋友做学习参考。
grails-docs-2.0.0
grails-1.2.2.zip
Grails 4 ships with the following dependency upgrades: Groovy 2.5.6 GORM 7 and Hibernate 5.4 (now the default version of Hibernate for new applications) Spring Framework 5.1.5 Spring Boot 2.1.3 ...
grails 中文文档+grails-fckeditor-0.9.5.zip插件
像Rails,Django和TurboGears这样的动态框架在Web开发领域开辟了一条新的道路,Grails基于这些概念之上,采用动态方法减小了Java平台上进行Web开发的复杂度,不过与那些框架不同的是,Grails是构建在Spring和...
prestige.zip,android的mvc模式,android的代码生成驱动的mvc模式。
grails-2.3.6
grails-5.1.2.zip
漏洞修补好象是传asp等后缀名的时候,生成的是nba的后缀。上传原来很简单在后缀加个空格就可以了
Getting-Started-with-Grails-Chinese,一本不错的grails入门书籍,希望对有志于grails的朋友们有用。
grails-4.0.4.zip
grails-quartz-0.4.1 插件,直接安装