-
Notifications
You must be signed in to change notification settings - Fork 219
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
setup of logger for slack java (logback / slf4j ) #1070
Comments
Hi, @MING-LI! Thank so much for writing in! 🎉 We have a "Use Logger" section in our "Bolt Basics" guide within the Java SDK docs that touches on using either |
now logback dependencies setup in pom, but the log file doesnt show. wonder what get wrong, I have try to use filewriter class of java which can write to the desired log destination to eliminate the without access rights factor. |
Hi @MING-LI, there is an example of I believe a fileAdapter may be required in order to log to a file. Hopefully this helps you out 🗺️ |
Not sure what still missed out, still no progress Here is how my logback.xml looks: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_ROOT" value="C:/ABCtask/CDEmyslackjavaapp/logs" />
<property name="LOG_FILE_NAME" value="slack_msg" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_ROOT}/${LOG_FILE_NAME}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_ROOT}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- each archived file's size will be max 10MB -->
<maxFileSize>10MB</maxFileSize>
<!-- 60 days to keep -->
<maxHistory>60</maxHistory>
<!-- total size of all archive files, if total size > 100GB, it will delete old archived file -->
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
</root>
</configuration> Here comes the pom.xml snippet: <dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.slack.api</groupId>
<artifactId>slack-api-client</artifactId>
<version>1.24.0</version>
</dependency>
</dependencies>
<build>
...other details etc...
</build> |
@MING-LI A few comments on your configuration:
I haven't checked your log configuration on my end but when you are stuck with logging, I generally recommend starting with the examples in the library website (logback-classic in this case) and then gradually modifying it. |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized. |
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number. |
By default following the example of slack web api, the dependencies like slf4j is necessary to include,
then it is needed to output and persist a log file in drive.
if there is any sample/documentation for slack logger setup for logging purpose both info or debug level (slf4j? or logback)
it could write a log file in a folder \log which the log folder is next to executable main program of .jar for sending msg to slack channel.
guess it needs an appender and config.xml (logback.xml) and add dependencies to pom file
got a main program and some threads will be generated by main function per message connection to be logged to a single logfile.
The text was updated successfully, but these errors were encountered: