日志 logs
更新時間 2025-10-23 09:41:29
最近更新時間: 2025-10-23 09:41:29
分享文章
logs命令查看函數的日志。
參數解析
| 參數全稱 | 參數縮寫 | Yaml 模式下必填 | Cli 模式下必填 | 參數含義 |
|---|---|---|---|---|
| region | - | 選填 | 必填 | 資源池ID,請參考資源池列表 |
| function-name | - | 選填 | 必填 | 函數名稱 |
| start-time | s | 選填 | 選填 | 開始時間戳,例如:1752740881 |
| end-time | e | 選填 | 選填 | 結束時間戳,例如:1754036841 |
| search | - | 選填 | 選填 | 查詢關鍵字 |
| reverse | - | 選填 | 選填 | 按時間倒序顯示 |
操作案例
Yaml 模式
進入到資源描述文件(s.yaml)所在的路徑,然后執行如下命令查看函數的日志:
s logsCli 模式
直接執行如下命令查看函數的日志:
s cli faas-cf logs --region bb9fdb42056f11eda1610242ac110002 --function-name hello-world執行完成輸出示例:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.8.RELEASE)
2025-10-22 10:20:05.689 INFO 2 --- [ main] c.e.w.WebFrameworkApplication : Starting WebFrameworkApplication v0.0.1-SNAPSHOT on globalresource-cached-rj46v with PID 2 (/code/webframework.jar started by root in /code)
2025-10-22 10:20:05.691 INFO 2 --- [ main] c.e.w.WebFrameworkApplication : No active profile set, falling back to default profiles: default
2025-10-22 10:20:08.014 INFO 2 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9000 (http)
2025-10-22 10:20:08.086 INFO 2 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2025-10-22 10:20:08.086 INFO 2 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24]
2025-10-22 10:20:08.213 INFO 2 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2025-10-22 10:20:08.213 INFO 2 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2413 ms
2025-10-22 10:20:08.601 INFO 2 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2025-10-22 10:20:08.916 INFO 2 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9000 (http) with context path ''
2025-10-22 10:20:08.918 INFO 2 --- [ main] c.e.w.WebFrameworkApplication : Started WebFrameworkApplication in 4.12 seconds (JVM running for 4.846)
2025-10-22 10:20:09.020 INFO 2 --- [nio-9000-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-10-22 10:20:09.020 INFO 2 --- [nio-9000-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2025-10-22 10:20:09.026 INFO 2 --- [nio-9000-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 6 ms