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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

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.

Community showcase
Published in Confluence Cloud

Bring information from GitHub into Confluence

I’ve got a couple of questions for you. Do you write technical documentation? What about technical documentation that references code and files from GitHub? In this article you will learn how to in...

32 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you