Skip to content

Commit

Permalink
CDR file only created when openvidu.cdr thanks to conditional logback…
Browse files Browse the repository at this point in the history
….xml
  • Loading branch information
pabloFuente committed Feb 2, 2018
1 parent 1182fec commit e9110c5
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 19 deletions.
9 changes: 8 additions & 1 deletion openvidu-server/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -211,6 +212,12 @@
<artifactId>openvidu-java-client</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.0.7</version>
</dependency>


<!-- Test dependencies -->

Expand Down
13 changes: 13 additions & 0 deletions openvidu-server/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Required metadata
sonar.projectKey=java-sonar-runner-simple
sonar.projectName=Sonar OpenVidu Server
sonar.projectVersion=1.0

# Comma-separated paths to directories with sources (required)
sonar.sources=src

# Language
sonar.language=java

# Encoding of the source files
sonar.sourceEncoding=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* CDR logger to register all information of each WebRTC connection:
* Enabled by property 'openvidu.cdr=true'
*
* - Participant unique identifier
* - Session unique identifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ server.ssl.enabled: false
server.address: 0.0.0.0

kms.uris=[\"ws://localhost:8888/kurento\"]

openvidu.secret: MY_SECRET
openvidu.publicurl: ngrok
openvidu.publicurl: ngrok
openvidu.cdr: false
openvidu.recording: false
openvidu.recording.path: /opt/openvidu/recordings
openvidu.recording.free-access: false
46 changes: 30 additions & 16 deletions openvidu-server/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<timestamp key="myTimestamp" timeReference="contextBirth" datePattern="HH-mm-ss"/>
<timestamp key="myTimestamp" timeReference="contextBirth"
datePattern="HH-mm-ss" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>[%p] %d [%.12t] %c \(%M\) - %msg%n</Pattern>
</layout>
</appender>
<appender name="CDR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>log/CDR.%d{yyyy-MM-dd}_${myTimestamp}.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
<TotalSizeCap>20GB</TotalSizeCap>
</rollingPolicy>
<layout>
<pattern>%m\n</pattern>
</layout>
</appender>
<logger name="io.openvidu.server.cdr.CallDetailRecord">
<level value="INFO" />
<appender-ref ref="CDR" />
</logger>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
<if condition='property("spring.profiles.active").contains("ngrok")'>
<then>
<property scope="context" resource="application-ngrok.properties" />
</then>
<else>
<property scope="context" resource="application.properties" />
</else>
</if>
<if condition='property("openvidu.cdr").contains("true")'>
<then>
<appender name="CDR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>log/CDR.%d{yyyy-MM-dd}_${myTimestamp}.log
</FileNamePattern>
<MaxHistory>30</MaxHistory>
<TotalSizeCap>20GB</TotalSizeCap>
</rollingPolicy>
<layout>
<pattern>%m\n</pattern>
</layout>
</appender>
<logger name="io.openvidu.server.cdr.CallDetailRecord">
<level value="INFO" />
<appender-ref ref="CDR" />
</logger>
</then>
</if>
</configuration>

0 comments on commit e9110c5

Please sign in to comment.