Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
keeleliin
keeleliin-wrapper
Commits
c9d5bb69
Commit
c9d5bb69
authored
Jul 31, 2015
by
priit
Browse files
Logimise parendamine
parent
b60e7d26
Changes
6
Hide whitespace changes
Inline
Side-by-side
config_dist.js
View file @
c9d5bb69
...
...
@@ -6,6 +6,14 @@ var config = require('./wrapper_configs/global');
"level": "ERROR",
"appender": {
"type": "smtp",
"layout": {
type: 'pattern',
pattern: "[%d] [%x{port}-%x{pid}][%5.5p] %c - %m",
tokens: {
pid: process.pid,
port: config.port
}
},
"recipients": "***********",
"sendInterval": 10, //sec
"transport": "SMTP",
...
...
middlewares/errorhandler.js
View file @
c9d5bb69
var
logger
=
require
(
'
log4js
'
).
getLogger
(
'
rout
er_middleware
'
);
var
logger
=
require
(
'
log4js
'
).
getLogger
(
'
error_handl
er_middleware
'
);
module
.
exports
=
{
common
:
function
(
err
,
req
,
res
,
next
)
{
logger
.
error
(
err
.
stack
);
logger
.
error
(
'
Common error:
'
,
err
);
res
.
status
(
err
.
status
||
500
);
res
.
send
({
...
...
@@ -11,7 +12,8 @@ module.exports = {
},
error404
:
function
(
req
,
res
,
next
)
{
logger
.
error
(
'
Error 404 happened
'
);
logger
.
debug
(
'
Error 404 happened
'
);
res
.
status
(
404
);
res
.
send
({
errors
:
'
Lehekülge ei leitud
'
...
...
src/service/cleanerService.js
View file @
c9d5bb69
...
...
@@ -25,7 +25,6 @@ var CleanerService = function () {
};
this
.
cleanSystem
=
function
()
{
logger
.
debug
(
'
clean A
'
);
var
folder
=
config
.
fs
.
storagePath
;
...
...
@@ -63,8 +62,7 @@ var CleanerService = function () {
logger
.
debug
(
filePath
);
fs
.
stat
(
filePath
,
function
(
err
,
stat
)
{
if
(
err
){
logger
.
error
(
filePath
);
logger
.
error
(
err
);
logger
.
error
(
filePath
,
err
);
return
continueScan
();
}
...
...
src/service/daoService.js
View file @
c9d5bb69
...
...
@@ -14,7 +14,7 @@ var DaoService = function(){
});
this
.
client
.
on
(
"
error
"
,
function
(
err
)
{
logger
.
error
(
"
Redis Error
"
+
err
);
logger
.
error
(
"
Redis Error
"
,
err
);
});
this
.
set
=
function
(
key
,
value
,
cb
){
...
...
wrapper_configs/global.js
View file @
c9d5bb69
...
...
@@ -47,6 +47,14 @@ config.log4js = {
"level": "ERROR",
"appender": {
"type": "smtp",
"layout": {
type: 'pattern',
pattern: "[%d] [%x{port}-%x{pid}][%5.5p] %c - %m",
tokens: {
pid: process.pid,
port: config.port
}
},
"recipients": "**********",
"sendInterval": 10, //sec
"transport": "SMTP",
...
...
@@ -129,8 +137,6 @@ var simpleCommandRequest = {
}
};
config
.
availableCommands
=
{
TOKENIZER
:
{
commandTemplate
:
'
python /var/www/bitweb.ee/keeleliin.bitweb.ee/wrapper/utils/tokenizer/tokenizer.py -i [data] -o [outputPath1]
'
...
...
@@ -156,11 +162,12 @@ config.availableCommands = {
};
config
.
availableWappers
=
{
TOKENIZER
:
{
title
:
'
Sõnestaja
'
,
port
:
3008
,
class
:
'
tokenizer
'
,
command
:
config
.
availableCommands
.
TOKENIZER
,
LAUSESTAJA
:
{
title
:
'
Lausestaja
'
,
port
:
3001
,
class
:
'
simpleLocalCommand
'
,
command
:
config
.
availableCommands
.
LAUSESTAJA
,
requestConf
:
simpleCommandRequest
},
MORFANALYSAATOR
:
{
...
...
@@ -170,26 +177,13 @@ config.availableWappers = {
command
:
config
.
availableCommands
.
MORFANALYSAATOR
,
requestConf
:
simpleCommandRequest
},
LAUSESTAJA
:
{
title
:
'
Lausestaja
'
,
port
:
3001
,
class
:
'
simpleLocalCommand
'
,
command
:
config
.
availableCommands
.
LAUSESTAJA
,
requestConf
:
simpleCommandRequest
},
OSALAUSESTAJA
:
{
title
:
'
Osalausesta
mine
'
,
title
:
'
Osalausesta
ja
'
,
port
:
3003
,
class
:
'
simpleLocalCommand
'
,
command
:
config
.
availableCommands
.
OSALAUSESTAJA
,
requestConf
:
simpleCommandRequest
},
ARCHIVE_EXTRACTOR
:
{
title
:
'
Arhiivi lahtipakkija
'
,
port
:
3007
,
class
:
'
archiveExtractor
'
,
requestConf
:
simpleCommandRequest
},
MORFYHESTAJA
:
{
title
:
'
Morfoloogiline ühestamine (kitsenduste grammatika)
'
,
port
:
3004
,
...
...
@@ -210,6 +204,21 @@ config.availableWappers = {
class
:
'
simpleLocalCommand
'
,
command
:
config
.
availableCommands
.
S6LT_SYN
,
requestConf
:
simpleCommandRequest
},
ARCHIVE_EXTRACTOR
:
{
title
:
'
Arhiivi lahtipakkija
'
,
port
:
3007
,
class
:
'
archiveExtractor
'
,
requestConf
:
simpleCommandRequest
},
TOKENIZER
:
{
title
:
'
Sõnestaja
'
,
port
:
3008
,
class
:
'
tokenizer
'
,
command
:
config
.
availableCommands
.
TOKENIZER
,
requestConf
:
simpleCommandRequest
}
};
...
...
www/server.js
View file @
c9d5bb69
...
...
@@ -36,10 +36,9 @@ app.use(bodyParser.json({limit: '1000mb'})); // for parsing application/json
app
.
use
(
multer
({
dest
:
config
.
fs
.
tmpPath
}));
// for parsing multipart/form-data
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'
public
'
)));
app
.
use
(
routerMiddleware
.
routeLogger
);
app
.
use
(
errorhandlerMiddleware
.
common
);
app
.
use
(
controllers
);
app
.
use
(
errorhandlerMiddleware
.
error404
);
app
.
use
(
errorhandlerMiddleware
.
common
);
/**
* Create HTTP server.
*/
...
...
@@ -56,7 +55,7 @@ function startCluster( instanceCount, cb ){
}
cluster
.
on
(
'
exit
'
,
function
(
worker
,
code
,
signal
)
{
log4jsLogger
.
info
(
'
worker
'
+
worker
.
process
.
pid
+
'
died; Code:
'
+
code
+
'
; Signal:
'
+
signal
);
log4jsLogger
.
error
(
'
worker
'
+
worker
.
process
.
pid
+
'
died; Code:
'
+
code
+
'
; Signal:
'
+
signal
);
});
cleanerService
.
init
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment