mirror of
https://github.com/Febbweiss/log-generator.git
synced 2026-03-04 14:15:42 +00:00
Feature: add exception generation
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -8,7 +8,7 @@
|
|||||||
<!-- Maven Metadatas -->
|
<!-- Maven Metadatas -->
|
||||||
<groupId>com.github.vspiewak</groupId>
|
<groupId>com.github.vspiewak</groupId>
|
||||||
<artifactId>log-generator</artifactId>
|
<artifactId>log-generator</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<!-- Project Metadatas -->
|
<!-- Project Metadatas -->
|
||||||
|
|||||||
@@ -52,9 +52,11 @@ public class App {
|
|||||||
while (counter.get() < params.logs) {
|
while (counter.get() < params.logs) {
|
||||||
total.incrementAndGet();
|
total.incrementAndGet();
|
||||||
counter.incrementAndGet();
|
counter.incrementAndGet();
|
||||||
int seed = new Random().nextInt(10);
|
int seed = new Random().nextInt(100);
|
||||||
if (seed > 7) {
|
if (seed > 95) {
|
||||||
executor.add(new SellRequest(total.get()));
|
executor.add(new ExceptionRequest());
|
||||||
|
} else if (seed > 60) {
|
||||||
|
executor.add(new SellRequest(total.get()));
|
||||||
} else {
|
} else {
|
||||||
executor.add(new SearchRequest(total.get()));
|
executor.add(new SearchRequest(total.get()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.github.vspiewak.loggenerator;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class ExceptionRequest implements Runnable {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ExceptionRequest.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
log.error("Unexpected error", new RuntimeException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user