Merge pull request #1588 from LemmyNet/improved-logging

Improved logging
This commit is contained in:
Dessalines 2021-04-21 10:34:47 -04:00 committed by GitHub
commit 9dc5605663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 25 deletions

View File

@ -7,7 +7,7 @@ services:
- "127.0.0.1:8536:8536" - "127.0.0.1:8536:8536"
restart: always restart: always
environment: environment:
- RUST_LOG=error - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_apub_receive=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
volumes: volumes:
- ./lemmy.hjson:/config/config.hjson:ro - ./lemmy.hjson:/config/config.hjson:ro
depends_on: depends_on:

View File

@ -1,6 +1,7 @@
use crate::{check_is_apub_id_valid, APUB_JSON_CONTENT_TYPE}; use crate::{check_is_apub_id_valid, APUB_JSON_CONTENT_TYPE};
use anyhow::anyhow; use anyhow::anyhow;
use lemmy_utils::{request::retry, LemmyError}; use lemmy_utils::{request::retry, LemmyError};
use log::info;
use reqwest::{Client, StatusCode}; use reqwest::{Client, StatusCode};
use serde::Deserialize; use serde::Deserialize;
use std::time::Duration; use std::time::Duration;
@ -73,11 +74,14 @@ where
.await?; .await?;
if res.status() == StatusCode::GONE { if res.status() == StatusCode::GONE {
info!("Fetched remote object {} which was deleted", url);
return Err(FetchError { return Err(FetchError {
inner: anyhow!("Remote object {} was deleted", url), inner: anyhow!("Fetched remote object {} which was deleted", url),
status_code: Some(res.status()), status_code: Some(res.status()),
}); });
} }
Ok(res.json().await?) let object = res.json().await?;
info!("Fetched remote object {}", url);
Ok(object)
} }

View File

@ -96,13 +96,6 @@ pub async fn community_inbox(
assert_activity_not_local(&activity)?; assert_activity_not_local(&activity)?;
insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?; insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?;
info!(
"Community {} received activity {:?} from {}",
community.name,
&activity.id_unchecked(),
&actor.actor_id()
);
community_receive_message( community_receive_message(
activity.clone(), activity.clone(),
community.clone(), community.clone(),
@ -130,6 +123,16 @@ pub(crate) async fn community_receive_message(
.await??; .await??;
check_community_or_site_ban(&person, to_community.id, context.pool()).await?; check_community_or_site_ban(&person, to_community.id, context.pool()).await?;
info!(
"Community {} received activity {} from {}",
to_community.name,
&activity
.id_unchecked()
.context(location_info!())?
.to_string(),
&person.actor_id().to_string()
);
let any_base = activity.clone().into_any_base()?; let any_base = activity.clone().into_any_base()?;
let actor_url = actor.actor_id(); let actor_url = actor.actor_id();
let activity_kind = activity.kind().context(location_info!())?; let activity_kind = activity.kind().context(location_info!())?;

View File

@ -61,7 +61,7 @@ use lemmy_db_schema::source::{
}; };
use lemmy_utils::{location_info, LemmyError}; use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use log::debug; use log::info;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt::Debug; use std::fmt::Debug;
use strum_macros::EnumString; use strum_macros::EnumString;
@ -115,13 +115,6 @@ pub async fn person_inbox(
assert_activity_not_local(&activity)?; assert_activity_not_local(&activity)?;
insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?; insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?;
debug!(
"Person {} received activity {:?} from {}",
person.name,
&activity.id_unchecked(),
&actor.actor_id()
);
person_receive_message( person_receive_message(
activity.clone(), activity.clone(),
Some(person.clone()), Some(person.clone()),
@ -142,6 +135,15 @@ pub(crate) async fn person_receive_message(
) -> Result<HttpResponse, LemmyError> { ) -> Result<HttpResponse, LemmyError> {
is_for_person_inbox(context, &activity).await?; is_for_person_inbox(context, &activity).await?;
info!(
"User received activity {:?} from {}",
&activity
.id_unchecked()
.context(location_info!())?
.to_string(),
&actor.actor_id().to_string()
);
let any_base = activity.clone().into_any_base()?; let any_base = activity.clone().into_any_base()?;
let kind = activity.kind().context(location_info!())?; let kind = activity.kind().context(location_info!())?;
let actor_url = actor.actor_id(); let actor_url = actor.actor_id();

View File

@ -8,7 +8,7 @@ services:
- "8536:8536" - "8536:8536"
restart: always restart: always
environment: environment:
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
volumes: volumes:
- ../lemmy.hjson:/config/config.hjson - ../lemmy.hjson:/config/config.hjson
depends_on: depends_on:

View File

@ -43,7 +43,7 @@ services:
environment: environment:
- LEMMY_TEST_SEND_SYNC=1 - LEMMY_TEST_SEND_SYNC=1
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
depends_on: depends_on:
- postgres_alpha - postgres_alpha
ports: ports:
@ -72,7 +72,7 @@ services:
environment: environment:
- LEMMY_TEST_SEND_SYNC=1 - LEMMY_TEST_SEND_SYNC=1
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
depends_on: depends_on:
- postgres_beta - postgres_beta
ports: ports:
@ -101,7 +101,7 @@ services:
environment: environment:
- LEMMY_TEST_SEND_SYNC=1 - LEMMY_TEST_SEND_SYNC=1
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
depends_on: depends_on:
- postgres_gamma - postgres_gamma
ports: ports:
@ -131,7 +131,7 @@ services:
environment: environment:
- LEMMY_TEST_SEND_SYNC=1 - LEMMY_TEST_SEND_SYNC=1
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
depends_on: depends_on:
- postgres_delta - postgres_delta
ports: ports:
@ -161,7 +161,7 @@ services:
environment: environment:
- LEMMY_TEST_SEND_SYNC=1 - LEMMY_TEST_SEND_SYNC=1
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- RUST_LOG=debug - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
depends_on: depends_on:
- postgres_epsilon - postgres_epsilon
ports: ports:

View File

@ -17,7 +17,7 @@ services:
- "127.0.0.1:8536:8536" - "127.0.0.1:8536:8536"
restart: always restart: always
environment: environment:
- RUST_LOG=error - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_apub_receive=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
volumes: volumes:
- ./lemmy.hjson:/config/config.hjson - ./lemmy.hjson:/config/config.hjson
depends_on: depends_on: