TypeORM 日志记录 - 已启用但没有输出
TypeORM logging - enabled but no output
简单的问题。 Typeorm 不记录任何内容。我已按照 https://orkhan.gitbook.io/typeorm/docs/logging
上的说明进行操作
ormconfig.json
{
"type": "mongodb",
"host": "aaa",
"port": 27017,
"username": "bbb",
"password": "ccc",
"ssl": true,
"database": "db",
"entities": ["dist/entity/*.js"],
"logging": true
}
我也试过logging: "all
、logging: ["query"]
,但是none有效果。
这是我设置应用程序的方式 (app.ts)
createConnection()
.then(async (connection) => {
// create koa app
const app = new Koa();
const router = new Router();
// register all application routes
AppRoutes.forEach((route) =>
router[route.method](route.path, route.action)
);
// run app
app.use(bodyParser());
app.use(router.routes());
app.use(router.allowedMethods());
app.listen(3000);
console.log("Koa application is up and running on port 3000");
})
.catch((error) => console.log("TypeORM connection error: ", error));
我的另一个 console.logs 显示正常,但没有来自 typeorm。
我用 tsc && node dist/app.js
开始这个项目
之后我发出 API 请求,查询端点,typeorm 将一直查询 Mongodb,然后 return 返回我的数据。但是我没有看到任何日志。
以前有没有人遇到过这个问题,或者这是一个新错误?
如果使用 mongodb - https://github.com/typeorm/typeorm/issues/1934
,则看起来像是 typeorm 中的错误
开业一年多了,看来不会很快修好。我需要日志记录的原因是解决我的设置的另一个问题,现在它似乎也是库中的一个错误。所以,我认为可以肯定地说 typeorm/mongodb 支持还不可靠。
简单的问题。 Typeorm 不记录任何内容。我已按照 https://orkhan.gitbook.io/typeorm/docs/logging
上的说明进行操作ormconfig.json
{
"type": "mongodb",
"host": "aaa",
"port": 27017,
"username": "bbb",
"password": "ccc",
"ssl": true,
"database": "db",
"entities": ["dist/entity/*.js"],
"logging": true
}
我也试过logging: "all
、logging: ["query"]
,但是none有效果。
这是我设置应用程序的方式 (app.ts)
createConnection()
.then(async (connection) => {
// create koa app
const app = new Koa();
const router = new Router();
// register all application routes
AppRoutes.forEach((route) =>
router[route.method](route.path, route.action)
);
// run app
app.use(bodyParser());
app.use(router.routes());
app.use(router.allowedMethods());
app.listen(3000);
console.log("Koa application is up and running on port 3000");
})
.catch((error) => console.log("TypeORM connection error: ", error));
我的另一个 console.logs 显示正常,但没有来自 typeorm。
我用 tsc && node dist/app.js
之后我发出 API 请求,查询端点,typeorm 将一直查询 Mongodb,然后 return 返回我的数据。但是我没有看到任何日志。
以前有没有人遇到过这个问题,或者这是一个新错误?
如果使用 mongodb - https://github.com/typeorm/typeorm/issues/1934
,则看起来像是 typeorm 中的错误开业一年多了,看来不会很快修好。我需要日志记录的原因是解决我的设置的另一个问题,现在它似乎也是库中的一个错误。所以,我认为可以肯定地说 typeorm/mongodb 支持还不可靠。