Helps with logback

50 views
Skip to first unread message

Chenguang He

unread,
Mar 5, 2013, 5:01:53 PM3/5/13
to lif...@googlegroups.com
Hey guys
I want to get all log about comet in code. Uhm.. i googled a round, didn't find any good way.


Chenguang He




Diego Medina

unread,
Mar 5, 2013, 5:08:10 PM3/5/13
to Lift
If you have a logback file like this

https://github.com/lift/lift_25_sbt/blob/master/scala_29/lift_basic/src/main/resources/logback.xml

you can just add lines like this one

<logger name="net.liftweb" level="warn" />

that will look at the package name / class name you want, and the log level.

so, are you looking for all comet logs internal to lift?

try:

<logger name="net.liftweb.http" level="info" />

you may get more than expected, but you can then tune it down.

Hope it helps.

Diego
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to liftweb+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://fmpwizard.telegr.am

Chenguang He

unread,
Mar 5, 2013, 5:10:48 PM3/5/13
to lif...@googlegroups.com
Thanks Diego,

I also want to get logs in scala code.
Like, appending them into a String or something.
Is that possible ?

Chenguang He



Diego Medina

unread,
Mar 5, 2013, 5:13:37 PM3/5/13
to Lift
could you explain a bit more, you mean, you want to add log entries
from your own snippets?

you do that by doing

import net.liftweb.common.Loggable

class MySnippet extends Loggable {

def render = {
logger.info("THis log entry will appear on the console or log files
if you enable info level for the package where this snippet is, you
can even include the snippet name on the xml file so that only this
snippet shows up on the logs")

Chenguang He

unread,
Mar 5, 2013, 5:18:28 PM3/5/13
to lif...@googlegroups.com
For example:

with following configuration

<logger name="net.liftweb.http" level="info" />
<root level="info">
<appender-ref ref="STDOUT" />
</root>

I get

16:12:45.043 [qtp1288896949-371 - /ajax_request/liftAjax.js] INFO net.liftweb.util.TimeHelpers - Service request (GET) /ajax_request/liftAjax.js returned 200, took 103 Milliseconds


But it is a output on console, what i want to get is something from a function, which like:

def getLogs:String = xxx

I want it return the logs, so i can get it and trim it

Thanks
Chenguang He

Diego Medina

unread,
Mar 5, 2013, 5:24:47 PM3/5/13
to Lift
ah, ok, no idea how to do that. You may want to ask on the logback mailing list

Diego

Chenguang He

unread,
Mar 5, 2013, 5:26:28 PM3/5/13
to lif...@googlegroups.com
Anyway, Thanks

Chenguang He



Reply all
Reply to author
Forward
0 new messages