diff options
-rw-r--r-- | config/log4j.properties | 6 | ||||
-rw-r--r-- | pom.xml | 11 | ||||
-rw-r--r-- | src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java | 5 |
3 files changed, 21 insertions, 1 deletions
diff --git a/config/log4j.properties b/config/log4j.properties new file mode 100644 index 0000000..6b34072 --- /dev/null +++ b/config/log4j.properties @@ -0,0 +1,6 @@ + +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file @@ -38,6 +38,16 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-log4j</artifactId> </dependency> <!-- Jackson JSON Mapper --> @@ -46,6 +56,7 @@ <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> + </dependencies> <build> diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java index c8c39d0..825ce8f 100644 --- a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java +++ b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java @@ -1,6 +1,7 @@ package uk.co.blatech.blaears.controllers; import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestBody; @@ -18,6 +19,8 @@ import java.io.IOException; @Controller public class GitPushController { + private static final Logger log = Logger.getLogger(GitPushController.class); + @RequestMapping(value = "/git/push", method = RequestMethod.POST) String push(@RequestBody Push pushMsg, Model model){ try { @@ -28,8 +31,8 @@ public class GitPushController { } commitMsg += commit.getMessage(); } + log.info(commitMsg); Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom beep | bash /home/smsd/msgrelay.bash "}); - Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + commitMsg + " | bash /home/smsd/msgrelay.bash "}); //DANGER Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + pushMsg.getUserName() + " pushed to " + pushMsg.getRepository().getName() + ": "+ commitMsg + " | bash /home/smsd/msgrelay.bash "}); |