Commit f6f5fc91 by Thomas Bosch

include logging

parent 2ceddc82
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin</artifactId> <artifactId>spring-boot-admin</artifactId>
<version>1.0.0.RC1</version> <version>1.0.0.RC2</version>
<properties> <properties>
<spring-boot.version>1.1.0.RELEASE</spring-boot.version> <spring-boot.version>1.1.4.RELEASE</spring-boot.version>
<bootstrap.version>2.3.2</bootstrap.version> <bootstrap.version>2.3.2</bootstrap.version>
<jquery.version>1.11.0</jquery.version> <jquery.version>1.11.0</jquery.version>
<angularjs.version>1.2.12</angularjs.version> <angularjs.version>1.2.12</angularjs.version>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
<artifactId>spring-boot-starter-admin-client</artifactId> <artifactId>spring-boot-starter-admin-client</artifactId>
<version>1.0.0.RC4</version> <version>1.0.0.RC5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -63,5 +63,6 @@ ...@@ -63,5 +63,6 @@
<script src="/scripts/app.js"></script> <script src="/scripts/app.js"></script>
<script src="/scripts/controllers/controllers.js"></script> <script src="/scripts/controllers/controllers.js"></script>
<script src="/scripts/services/services.js"></script> <script src="/scripts/services/services.js"></script>
<script src="/scripts/filters/filters.js"></script>
</body> </body>
</html> </html>
...@@ -34,22 +34,38 @@ angular.module('springBootAdmin', [ ...@@ -34,22 +34,38 @@ angular.module('springBootAdmin', [
.state('apps.details.infos', { .state('apps.details.infos', {
url: '/infos', url: '/infos',
templateUrl: 'views/apps/details/infos.html', templateUrl: 'views/apps/details/infos.html',
controller: 'infosCtrl' controller: 'detailsInfosCtrl'
}) })
.state('apps.details.metrics', { .state('apps.details.metrics', {
url: '/metrics', url: '/metrics',
templateUrl: 'views/apps/details/metrics.html', templateUrl: 'views/apps/details/metrics.html',
controller: 'metricsCtrl' controller: 'detailsMetricsCtrl'
}) })
.state('apps.details.env', { .state('apps.details.env', {
url: '/env', url: '/env',
templateUrl: 'views/apps/details/env.html', templateUrl: 'views/apps/details/env.html',
controller: 'envCtrl' controller: 'detailsEnvCtrl'
}) })
.state('apps.details.props', { .state('apps.details.props', {
url: '/props', url: '/props',
templateUrl: 'views/apps/details/props.html', templateUrl: 'views/apps/details/props.html',
controller: 'propsCtrl' controller: 'detailsPropsCtrl'
})
.state('apps.logging', {
url: '/logging/:id',
abstract: true,
templateUrl: 'views/apps/logging.html',
controller: 'detailsCtrl'
})
.state('apps.logging.read', {
url: '/read',
templateUrl: 'views/apps/logging/read.html',
controller: 'loggingReadCtrl'
})
.state('apps.logging.write', {
url: '/write',
templateUrl: 'views/apps/logging/write.html',
controller: 'loggingWriteCtrl'
}); });
}) })
.run(function ($rootScope, $state, $stateParams, $log) { .run(function ($rootScope, $state, $stateParams, $log) {
......
...@@ -14,6 +14,10 @@ angular.module('springBootAdmin') ...@@ -14,6 +14,10 @@ angular.module('springBootAdmin')
$scope.showDetails = function(id) { $scope.showDetails = function(id) {
$location.path('/apps/details/' + id + '/infos'); $location.path('/apps/details/' + id + '/infos');
}; };
// callback for ng-click 'showLogging':
$scope.showLogging = function(id) {
$location.path('/apps/logging/' + id + '/read');
};
// callback for ng-click 'refresh': // callback for ng-click 'refresh':
$scope.refresh = function(id) { $scope.refresh = function(id) {
$scope.application = Application.query({id: id}, function(application) { $scope.application = Application.query({id: id}, function(application) {
...@@ -30,23 +34,38 @@ angular.module('springBootAdmin') ...@@ -30,23 +34,38 @@ angular.module('springBootAdmin')
.controller('detailsCtrl', function ($scope, $stateParams, Application) { .controller('detailsCtrl', function ($scope, $stateParams, Application) {
$scope.application = Application.query({id: $stateParams.id}); $scope.application = Application.query({id: $stateParams.id});
}) })
.controller('infosCtrl', function ($scope, $stateParams, Application, ApplicationDetails) { .controller('detailsInfosCtrl', function ($scope, $stateParams, Application, ApplicationDetails) {
$scope.application = Application.query({id: $stateParams.id}, function(application) { $scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationDetails.getInfo(application); ApplicationDetails.getInfo(application);
}); });
}) })
.controller('metricsCtrl', function ($scope, $stateParams, Application, ApplicationDetails) { .controller('detailsMetricsCtrl', function ($scope, $stateParams, Application, ApplicationDetails) {
$scope.application = Application.query({id: $stateParams.id}, function(application) { $scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationDetails.getMetrics(application); ApplicationDetails.getMetrics(application);
}); });
}) })
.controller('envCtrl', function ($scope, $stateParams, Application, ApplicationDetails) { .controller('detailsEnvCtrl', function ($scope, $stateParams, Application, ApplicationDetails) {
$scope.application = Application.query({id: $stateParams.id}, function(application) { $scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationDetails.getEnv(application); ApplicationDetails.getEnv(application);
}); });
}) })
.controller('propsCtrl', function ($scope, $stateParams, Application, ApplicationDetails) { .controller('detailsPropsCtrl', function ($scope, $stateParams, Application, ApplicationDetails) {
$scope.application = Application.query({id: $stateParams.id}, function(application) { $scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationDetails.getProps(application); ApplicationDetails.getProps(application);
}); });
})
.controller('loggingCtrl', function ($scope, $stateParams, Application) {
$scope.application = Application.query({id: $stateParams.id});
})
.controller('loggingReadCtrl', function ($scope, $stateParams, Application, ApplicationLogging) {
$scope.$parent.application.logger = new Object();
$scope.readLoglevel = function(application) {
ApplicationLogging.getLoglevel(application);
};
})
.controller('loggingWriteCtrl', function ($scope, $stateParams, Application, ApplicationLogging) {
$scope.$parent.application.logger = new Object();
$scope.writeLoglevel = function(application) {
ApplicationLogging.setLoglevel(application);
};
}); });
...@@ -27,13 +27,17 @@ angular.module('springBootAdmin.services', ['ngResource']) ...@@ -27,13 +27,17 @@ angular.module('springBootAdmin.services', ['ngResource'])
return $http.get(app.url + '/health').success(function(response) { return $http.get(app.url + '/health').success(function(response) {
if (typeof(response) === 'string' && response.indexOf('ok') != -1 if (typeof(response) === 'string' && response.indexOf('ok') != -1
|| typeof(response.status) === 'string' && || typeof(response.status) === 'string' &&
(response.status.indexOf('ok') != -1 || response.status.indexOf('UP') != -1)) { (response.status.indexOf('ok') != -1 || response.status.indexOf('UP') != -1)) {
app.online = true; app.up = true;
} else if (typeof(response.status) === 'string' && response.status.indexOf('DOWN') != -1) {
app.down = true;
} else if (typeof(response.status) === 'string' && response.status.indexOf('OUT-OF-SERVICE') != -1) {
app.outofservice = true;
} else { } else {
app.online = false; app.unknown = true;
} }
}).error(function() { }).error(function() {
app.online = false; app.offline = true;
}); });
} }
this.getLogfile = function(app) { this.getLogfile = function(app) {
...@@ -80,4 +84,30 @@ angular.module('springBootAdmin.services', ['ngResource']) ...@@ -80,4 +84,30 @@ angular.module('springBootAdmin.services', ['ngResource'])
} }
}); });
} }
}])
.service('ApplicationLogging', ['$http', function($http) {
this.getLoglevel = function(app) {
return $http.get(app.url +
'/jolokia/exec/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/getLoggerLevel/' +
app.logger.name)
.success(function(response) {
if (response['value'].length > 0) {
app.logger.loglevel = response['value'];
} else {
app.logger.loglevel = '<unknown>';
}
});
}
this.setLoglevel = function(app) {
return $http.get(app.url +
'/jolokia/exec/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/setLoggerLevel/' +
app.logger.name + '/' + app.logger.loglevel)
.success(function(response) {
if (response['status'] == 200) {
app.logger.success = true;
} else {
app.logger.success = false;
}
});
}
}]); }]);
...@@ -45,11 +45,20 @@ a:hover.spring-boot-logo span { ...@@ -45,11 +45,20 @@ a:hover.spring-boot-logo span {
opacity: 1; opacity: 1;
} }
span.online { span.up {
color: #00AA00; color: #00AA00;
} }
span.offline { span.offline {
color: #DD0000; color: #DD0000;
font-weight: bold; font-weight: bold;
}
span.down, span.outofservice {
color: #FF8800;
font-weight: bold;
}
span.unknown {
color: #DDDDDD;
} }
\ No newline at end of file
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Used Memory</th> <th>Used Memory</th>
<th>Free Memory</th> <th>Free Memory</th>
<th>Processors</th> <th>Used Heap</th>
</tr> <th>Max Heap</th>
</thead> <th>Processors</th>
<tbody> <th>Uptime</th>
<tr> </tr>
<td>{{ application.metrics['mem'] / 1024 | number:2 }} MB</td> </thead>
<td>{{ application.metrics['mem.free'] / 1024 | number:2 }} MB</td> <tbody>
<td>{{ application.metrics['processors'] }}</td> <tr>
</tr> <td>{{ application.metrics['mem'] / 1024 | number:2 }} MB</td>
</tbody> <td>{{ application.metrics['mem.free'] / 1024 | number:2 }} MB</td>
</table> <td>{{ application.metrics['heap.used'] / 1024 | number:2 }} MB</td>
<td>{{ application.metrics['heap'] / 1024 | number:2 }} MB</td>
<td>{{ application.metrics['processors'] }}</td>
<td>{{ application.metrics['uptime'] / 60000 | ceil }}:{{ application.metrics['uptime'] % 60000 / 1000 | ceil }} min</td>
</tr>
</tbody>
</table>
...@@ -21,13 +21,17 @@ ...@@ -21,13 +21,17 @@
<td>{{ application.id }}</td> <td>{{ application.id }}</td>
<td>{{ application.version }}</td> <td>{{ application.version }}</td>
<td> <td>
<span ng-show="application.online" class="online">online</span> <span ng-show="application.up" class="up">up</span>
<span ng-show="!application.online" class="offline">offline</span> <span ng-show="application.down" class="down">down</span>
<span ng-show="application.outofservice" class="oufofservice">out of service</span>
<span ng-show="application.unknown" class="unknown">unknown</span>
<span ng-show="application.offline" class="offline">offline</span>
</td> </td>
<td> <td>
<span ng-show="application.online" style="float:right"> <span ng-show="application.up" style="float:right">
<a ng-show="application.providesLogfile" target="_self" ng-href="{{application.urlLogfile}}"><button class="btn btn-success">Logfile</button></a> <a ng-show="application.providesLogfile" target="_self" ng-href="{{application.urlLogfile}}"><button class="btn btn-success">Logfile</button></a>
<button ng-click="showDetails(application.id)" class="btn btn-success">Details</button> <button ng-click="showDetails(application.id)" class="btn btn-success">Details</button>
<button ng-click="showLogging(application.id)" class="btn btn-success">Logging</button>
<!-- <button ng-click="refresh(application.id)" class="btn btn-success">Refresh</button> --> <!-- <button ng-click="refresh(application.id)" class="btn btn-success">Refresh</button> -->
</span> </span>
</td> </td>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<include resource="org/springframework/boot/logging/logback/base.xml"/> <include resource="org/springframework/boot/logging/logback/base.xml"/>
<jmxConfigurator/>
<logger name="de.codecentric" level="DEBUG" /> <logger name="de.codecentric" level="DEBUG" />
<logger name="org.springframework.data" level="INFO" /> <logger name="org.springframework.data" level="INFO" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment