Fork me on GitHub
#pedestal
<
2017-07-18
>
lxsameer08:07:08

@ddeaguiar The way pedestal logging works is annoying as a library it should provide some means to customize its logging. Also it's hard to find what you what in those huge strings

ddeaguiar14:07:19

@lxsameer re: log customization, the pedestal.log library is just a wrapper around the slf4j-api. Pedestal services created via the pedestal-service lein template have a dependency on logback. Logging is configurable via the logback.xml config file. Is there something specific you are having trouble configuring?

ddeaguiar14:07:59

@lxsameer re: viewing the logs, I recommend using lnav (http://lnav.org/). I’ve created a lnav formatter based on the lnav java formatter. You may find it useful. https://github.com/ddeaguiar/dotfiles/blob/master/shell/.lnav-formats/pedestal_log.json

lxsameer14:07:34

@ddeaguiar yeah. As a library it would be nice for pedestal to instead of logging hand the logs to the user to handle and has a default handler . I know that sl4j is a wrapper and i can use other logger backend to setup my logging

lxsameer14:07:22

@ddeaguiar but that's not the case , because for example for my current use case, i don't want pedestal logging, so I have to either blacklist the namespace in my logger or change the way of logging

lxsameer14:07:04

but if pedestal instead of logging directly just send the log data to a function provided by the user

ddeaguiar14:07:10

If I understand correctly, you don’t want to see logging for any pedestal namespace, correct?

lxsameer14:07:13

it would be much easier to handle

lxsameer14:07:32

@ddeaguiar no, just some of them

ddeaguiar14:07:50

Ok, so you’ve already mentioned one option which is to update your log config to suppress logging from specific namespaces.

ddeaguiar14:07:14

I personally find that to be a satisfactory solution. However, there is another option

ddeaguiar14:07:41

You can create your own logging implementation and plug it into Pedestal. All you have to do is implement a protocol https://github.com/pedestal/pedestal/blob/master/log/src/io/pedestal/log.clj#L29

ddeaguiar14:07:48

Check out the ns doc-string for details on how to configure that: https://github.com/pedestal/pedestal/blob/master/log/src/io/pedestal/log.clj#L14

ddeaguiar14:07:25

I think that provides the flexibility you are looking for

lxsameer14:07:17

yeah it does . I'll return with my idea about how pedestals logging should be as soon as i done with it, It much easier to communicate via code 🙂

ddeaguiar14:07:27

Sure! Glad to help and looking forward to seeing what you come up with 🙂

lxsameer14:07:57

@ddeaguiar are you a contributor to pedestal ?

ddeaguiar14:07:39

I’ve contributed but I’m not a core contributor

vijayakkineni22:07:24

How do i point pedestal app to an external logback.xml file?

ddeaguiar22:07:12

@vijayakkineni the log config needs to be on the classpath. If adding the config file to the resources dir does not suit your needs, you should be able to add the file to the classpath when starting the service. I suspect this can be done via java -classpath ... but I don’t have first hand experience with it.