It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Stash] Create separate log file for plugin

I have seen lot of questions and forums around this but none of them provides a satisfactory answer. I would like to create a separate log file for my plugin which has nothing to do with atlassian-stash.log, where I have complete control over root-logging level (info, debug, warn).

If someone can provide an example code, I can offer a one-way ticket to heaven.

2 answers

1 accepted

0 votes
Answer accepted

Thanks again to Charles O'Farrell who guided me to correct solution, here I will outline if someone else wants to do that:

  • ${PLUGIN_FOLDER}/pom.xml - added following dependency
    • <dependency>
      <!-- <version>1.0.11</version> version from stash-parent/pom.xml -->
  • ${PLUGIN_FOLDER}/src/main/resources/atlassian-plugin.xml - add following component
    • <component key="stashbotLoggerFactory" class="com.chegg.plugin.prercv.YOURLoggerFactory"/>
  • ${PLUGIN_FOLDER}/src/main/resources/logback.xml - Created pretty similar to yours containing only one appender with similar settings (creating ROOT on package)
  • ${PLUGIN_FOLDER}/src/main/java/ - Pretty much similar to what StashbotLoggerFactory is.

You will find the logs under ${PLUGIN_FOLDER}/target/container/tomcat7x/cargo-stash-home/YOUR.log

Not sure if I can offer the ticket exclusively to you Charles since Carl's changes made my day, nevertheless a touching thanks since it made my life really easy.

I'm OK with an upvote. :)

Hi Zeeshan,

Is it possible to look at your code that you tried for the following?

I don't think I've seen anyone else get that working except for Carl. You need to use his StashbotLoggerFactory instead of raw SLF4J loggers. I've just tried it locally and it works fine.



FYI You don't need any of the log4j stuff, we only use logback.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted 5 hours ago in United States

Summit Recap!

For all those who couldn't make it to Summit (and even those who could) we are doing a recap of Summit 2019! Come out to hear about all the updates, get some free food and drinks, and some swag. ...

8 views 0 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you